我正在使用LiveQueryParse,但是当我同时使用两个gradle链接时,出现以下错误:
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
我正在使用这些gradle链接,这给了我一个错误:
compile 'com.github.tgio:parse-livequery:1.0.3'
compile 'com.parse:parse-android:1.16.3'
我已经将以下代码放入我的应用Gradle文件中:
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.dcas.user"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
defaultConfig {
multiDexEnabled true
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:27.0.1'
compile 'com.android.support:exifinterface:27.0.1'
testImplementation 'junit:junit:4.12'
compile 'com.android.support:cardview-v7:27.0.1'
compile 'com.github.tgio:parse-livequery:1.0.3'
compile 'com.parse:parse-android:1.16.3'
compile 'com.android.support:multidex:1.0.1'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
}
我也已经清理了我的项目,删除了构建文件以及.gradle文件夹,但是仍然出现错误。我已经搜索了类似的问题和解决方案,但仍然无法正常工作。
答案 0 :(得分:2)
您的编译SDK版本 必须与支持库匹配:
implementation 'com.android.support:appcompat-v7:27.1.1'
我还要像下面那样更新您的依赖项:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:exifinterface:27.1.1'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.github.tgio:parse-livequery:1.0.3'
implementation 'com.parse:parse-android:1.17.3'
implementation 'com.android.support:multidex:1.0.3'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
}
希望这对您有帮助
答案 1 :(得分:2)
implementation
而不是 compile
。您应该设置
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "//"
minSdkVersion 19
targetSdkVersion 27
然后使用
implementation 'com.parse:parse-android:1.17.3'