React Native:视频会议API上的外部库Dex合并错误

时间:2019-01-16 13:19:17

标签: android api react-native sdk

我正在使用agora.io API构建视频会议react-native应用程序。当我尝试运行该应用程序时,它给了我dex合并错误。

  

任务':app:transformDexArchiveWithExternalLibsDexMergerForDebug'的执行失败。   com.android.builder.dexing.DexArchiveMergerException:合并dex档案时出错:/Users/appleretina/Documents/GitHub/agoraVideoCall-master/android/app/build/intermediates/transforms/dexBuilder/debug/0.jar,/ Users / appleretina / Documents / GitHub / agoraVideoCall-master / android / app / build / intermediates / transforms / dexBuilder / debug / 1.jar,/ Users / appleretina / Documents / GitHub / agoraVideoCall-master / android / app / build / intermediates / transforms /dexBuilder/debug/2.jar,/Users/appleretina/Documents/GitHub/agoraVideoCall-master/android/app/build/intermediates/transforms/dexBuilder/debug/3.jar,/ Users / appleretina / Documents / GitHub / agoraVideoCall -master / android / app / build / intermediates / transforms / dexBuilder / debug / 4.jar,/ Users / appleretina / Documents / GitHub / agoraVideoCall-master / android / app / build / intermediates / transforms / dexBuilder / debug / 5。罐   ...

我已经尝试了所有列出的解决dex合并错误的解决方案,包括删除构建文件夹,将multiDexEnabled设置为true,排除重复的依赖项,但是在我的情况下没有解决方案。

App.gradle

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion

    defaultConfig {
        applicationId "com.agoravideocall"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"
        multiDexEnabled true

        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }
    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            def versionCodes = ["armeabi-v7a":1, "x86":2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}

dependencies {
    compile project(':react-native-agora')
    implementation project(':react-native-agora')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    implementation "com.facebook.react:react-native:+"  // From node_modules
}

build.gradle(agora视频通话)

apply plugin: 'com.android.library'

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion

    defaultConfig {
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"


        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation "com.facebook.react:react-native:+"
    implementation fileTree(dir: 'libs', include: ['*.jar'])
}

我该如何解决这个问题。

0 个答案:

没有答案