合并dex档案时如何解决错误?

时间:2019-04-15 05:20:04

标签: android parse-platform

在“构建”面板中出现此错误:

* What went wrong:
Execution failed for task ':app:mergeExtDexDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: 
  Program type already present: com.parse.AbstractQueryController$1

在将此库实现'com.parse:parse-livequery-android:1.0.6'添加到我现有的实现中之后:

  implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'androidx.appcompat:appcompat:1.1.0-alpha02'
    implementation 'com.google.android.material:material:1.1.0-alpha04'
    implementation 'com.google.android.gms:play-services:11.4.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.2-alpha01'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.2-alpha01'
    //image_view_cornered_lib
    implementation 'com.github.siyamed:android-shape-imageview:0.9.3@aar'
    //circle image view lib
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    //parse libs here
    implementation 'com.github.parse-community.Parse-SDK-Android:parse:1.19.0'
    implementation 'com.github.parse-community.Parse-SDK-Android:fcm:1.19.0'
    implementation 'com.github.parse-community.Parse-SDK-Android:ktx:1.19.0'

2 个答案:

答案 0 :(得分:0)

com.parse.AbstractQueryController模块由多个库使用

在您的情况下,必须是 com.parse:parse-livequery-android:1.0.6com.github.parse-community.Parse-SDK-Android:parse:1.19.0

要找到模块应用程序的依赖项列表(应用程序的默认模块名称),我们可以做一个

  

gradlew应用程序:依赖项

检索所有库的列表。

找到两次使用不同版本的模块后,将其排除在外

implementation ('com.parse:parse-livequery-android:1.0.6') {
    exclude module: 'duplicated module'
}

答案 1 :(得分:0)

您尝试过吗:

app / build.gradle中:

android {
    defaultConfig {
       multiDexEnabled true
    }
}