无法使用 LiveParse 查询合并 dex

Unable to merge dex using LiveParse Query

我正在使用 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 文件夹,但我仍然收到错误消息。我已经搜索过类似的问题和解决方案,但仍然没有用。

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

希望对您有所帮助

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

你应该设置

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

然后使用

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