失败的任务:':app:transformClassesWithJarMergingForDebug'

时间:2018-04-04 16:38:14

标签: react-native

添加了“react-native-image-metedata”,问题就开始了。现在一个接一个地解决了错误,现在面临错误,无法解决。任何帮助将不胜感激。

出了什么问题:

  

任务执行失败   ':应用程序:transformClassesWithJarMergingForDebug' &GT。   com.android.build.api.transform.TransformException:   java.util.zip.ZipException:重复条目:   COM /提请/成像/ ImageMetadataReader.class

build,gradle文件看起来像,也添加了multiDexEnabled设置为true,再次清理和构建。然后错误仍然存​​在。

apply plugin: "com.android.application"
import com.android.build.OutputFile
project.ext.react = [
   entryFile: "index.js"
]
apply from: "../../node_modules/react-native/react.gradle"
def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
    applicationId "com.abc"
    minSdkVersion 16
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
    ndk {
        abiFilters "armeabi-v7a", "x86"
    }
}
dexOptions {
    javaMaxHeapSize "4g"
}
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.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 fileTree(dir: "libs", include: ["*.jar"])
compile project(':react-native-image-metedata')
compile project(':realm')
compile project(':react-native-vector-icons')
compile project(':react-native-sha256')
compile project(':react-native-linear-gradient')
compile project(':react-native-image-resizer')
compile project(':react-native-image-picker')
compile project(':react-native-fs')
compile project(':react-native-exit-app')
compile project(':react-native-camera-kit')
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+"  // From node_modules
}
task copyDownloadableDepsToLibs(type: Copy) {
 from configurations.compile
 into 'libs'
}

提前致谢!

0 个答案:

没有答案