React-native:app:transformDexArchiveWithExternalLibsDexMergerForDebug失败

时间:2018-10-04 07:18:30

标签: reactjs react-native react-native-android

当我以96%的比例运行本机运行Android时:app:transformDexArchiveWithExternalLibsDexMergerForDebug ,我收到此错误。我开始停下来,找不到解决方案。您有这些问题吗?

android {
compileSdkVersion 27
buildToolsVersion '27.0.3'

defaultConfig {
    applicationId "com.ykstyt"
    minSdkVersion 16
    targetSdkVersion 26
    versionCode 3
    versionName "1.0.0"
    ndk {
        abiFilters "armeabi-v7a", "x86"
    }
}
signingConfigs {
    release {
        if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
            storeFile file(MYAPP_RELEASE_STORE_FILE)
            storePassword MYAPP_RELEASE_STORE_PASSWORD
            keyAlias MYAPP_RELEASE_KEY_ALIAS
            keyPassword MYAPP_RELEASE_KEY_PASSWORD
        }
    }
}
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"
        signingConfig signingConfigs.release
    }
}

applicationVariants.all { variant ->
    variant.outputs.each { output ->
        def versionCodes = ["armeabi-v7a":1, "x86":2]
        def abi = output.getFilter(OutputFile.ABI)
        if (abi != null) {  
            output.versionCodeOverride =
                    versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
        }
    }
}

}

dependencies {
compile project(':react-native-text-input-mask')
compile project(':react-native-admob')
compile project(':react-native-onesignal')
compile project(':react-native-vector-icons')
compile project(':react-native-pdf')
compile project(':react-native-fetch-blob')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+"
implementation 'com.onesignal:OneSignal:[3.9.1, 3.99.99]'

}

任务copyDownloadableDepsToLibs(类型:复制){     从configuration.compile     进入'libs' }

应用插件:“ com.onesignal.androidsdk.onesignal-gradle-plugin”

1 个答案:

答案 0 :(得分:0)

第1步:删除整个android文件夹

运行:react-native升级

接受结束。

完成运行后:react-native run-android

就这么多:D