出于某种原因,我现在几个小时都无法通过这个错误...当我尝试调试我的应用程序时(在模拟器/真实设备上相同)。 我知道网站上也有类似的问题,但是没有一个能帮助我的不同依赖关系和项目......
完整错误:
失败:构建因异常而失败。
com.android.build.api.transform.TransformException:com.android.ide.common.process.ProcessException:java.util.concurrent.ExecutionException:java.lang.UnsupportedOperationException
我的build.gradle
apply plugin: "com.android.application"
import com.android.build.OutputFile
apply from: "../../node_modules/react-native/react.gradle"
def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion 23
buildToolsVersion '25.0.0'
defaultConfig {
minSdkVersion 19
targetSdkVersion 22
versionCode 18
versionName "1.1.6"
ndk {
abiFilters "armeabi-v7a", "x86"
}
// multiDexEnabled true
}
signingConfigs {
release {
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 {
signingConfig signingConfigs.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
}
}
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile project(':react-native-doc-viewer')
compile project(':react-native-bluetooth-serial')
compile project(':react-native-fcm')
compile project(':react-native-toast')
compile project(':react-native-maps')
compile project(':react-native-vector-icons')
compile project(':bugsnag-react-native')
compile "com.facebook.react:react-native:+"
compile 'com.google.firebase:firebase-core:10.2.1'
compile project(':ReactNativeVibration')
compile 'com.google.android.gms:play-services-maps:10.2.1'
compile 'com.google.android.gms:play-services-location:10.2.1'
compile project(':react-native-fetch-blob')
}
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply plugin: 'com.google.gms.google-services'
错误日志: Dex:将字节码转换为dex时出错: 原因:com.android.dex.DexException:多个dex文件定义 LCOM /谷歌/机器人/克/普通/ API / ZZF; 意外的顶级例外情况: com.android.dex.DexException:多个dex文件定义 LCOM /谷歌/机器人/克/普通/ API / ZZF; 在com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:591) 在com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:546) 在com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:528) 在com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:164) 在com.android.dx.merge.DexMerger.merge(DexMerger.java:188) 在com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504) 在com.android.dx.command.dexer.Main.runMonoDex(Main.java:334) 在com.android.dx.command.dexer.Main.run(Main.java:277) 在com.android.dx.command.dexer.Main.main(Main.java:245) 在com.android.dx.command.Main.main(Main.java:106)
:app:transformClassesWithDexForDebug FAILED
失败:构建因异常而失败。
出了什么问题: 任务':app:transformClassesWithDexForDebug'执行失败。
com.android.build.api.transform.TransformException:com.android.ide.common.process.ProcessException:java.util.concurrent.ExecutionException:java.lang.UnsupportedOperationException
尝试: 使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获得更多日志输出。
建立失败