嗨,我的android studio上有错误
错误:将字节码转换为dex时出错:原因: com.android.dex.DexException:多个dex文件定义 LCOM /谷歌/机器人/克/内部/ ZZEE;
错误:任务执行失败 ':应用程序:transformClassesWithDexForDebug'
com.android.build.api.transform.TransformException:com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException:执行时出错 带有主类com.android.dx.command.Main的java进程 arguments {--dex --num-threads = 4 --output
我的build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.brommko.android.promophotography"
minSdkVersion 15
targetSdkVersion 25
versionCode 14
versionName "3.4"
manifestPlaceholders = [manifestApplicationId : "${applicationId}",
onesignal_app_id : "c0fbadc6-4013-4613-b00b-566eab144d3c",
onesignal_google_project_number: "4122760152"]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.onesignal:OneSignal:3.+@aar'
compile 'com.google.android.gms:play-services-gcm:11.0.4'
compile "com.google.android.gms:play-services-location:11.0.4"
compile 'com.github.quentin7b:android-location-tracker:3.2'
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.google.firebase:firebase-ads:10.0.1'
compile 'com.google.firebase:firebase-crash:10.0.1'
compile 'org.jetbrains:annotations-java5:15.0'
compile 'com.github.hotchemi:android-rate:1.0.1'
}
apply plugin: 'com.google.gms.google-services'
答案 0 :(得分:1)
这是因为你有混合版本的依赖项。问题是因为 OneSignal 会自动添加以下依赖项:
com.google.android.gms - Version 11.2.+
com.android.support - Version 26.1.+
因此,您需要更改支持,Firebase和Google Play服务依赖项版本。它会是这样的:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
// Don't use +, use exact dependency version.
//compile 'com.onesignal:OneSignal:3.+@aar'
compile 'com.onesignal:OneSignal:[3.6.5, 3.99.99]'
compile 'com.google.android.gms:play-services-gcm:11.2.1'
compile "com.google.android.gms:play-services-location:11.2.1"
compile 'com.google.firebase:firebase-messaging:11.2.1'
compile 'com.google.firebase:firebase-ads:11.2.1'
compile 'com.google.firebase:firebase-crash:11.2.1'
compile 'com.github.quentin7b:android-location-tracker:3.2'
compile 'org.jetbrains:annotations-java5:15.0'
compile 'com.github.hotchemi:android-rate:1.0.1'
}
了解详情