无法使用LiveParse查询合并dex

3

我正在处理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文件夹,但是我仍然收到错误提示。我已经搜索了类似的问题和解决方案,但仍然无法解决。

2个回答

2
  • 你应该使用implementation而不是compile
  • 设置所有更新版本。

你应该设置

compileSdkVersion 27
        buildToolsVersion "27.0.3"
        defaultConfig {
            applicationId "//"
            minSdkVersion 19
            targetSdkVersion 27

然后使用

implementation 'com.parse:parse-android:1.17.3'

1
非常感谢您的回答,@IntelliJ Amiya。 - Usman Khan
@UKhan 祝你编程愉快,继续前进。 - IntelliJ Amiya

1
你的编译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'
}

我希望这能帮到你。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接