app:transformClassesWithDexForDebug FAILED
Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/ads/identifier/AdvertisingIdClient$Info;
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
`com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-7-openjdk-i386/bin/java'' finished with non-zero exit value 2`
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "paritosh.d9.groceries"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
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:23.4.0'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.android.support:design:23.1.1'
compile 'com.facebook.android:facebook-android-sdk:4.11.0'
compile 'com.facebook.android:audience-network-sdk:4.7.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.google.android.gms:play-services-auth:8.4.0'
}
我正试图解决这个问题。我试过了 删除我的播放服务依赖项,但这并没有解决问题。 请帮我解决这个问题。感谢
答案 0 :(得分:3)
您在依赖项中有重复 - 两个类是相同的。您应该了解哪个lib包含您应该排除的那个。为此,您需要在控制台中运行下一行:
./gradlew app:androidDependencies
此外,您可以对Android Studio中的 Gradle插件执行相同操作:
输出将如下:
+--- com.android.support:multidex:1.0.1
+--- io.realm:realm-android-library:1.0.0
| \--- com.getkeepsafe.relinker:relinker:1.2.1
+--- com.android.support:appcompat-v7:23.3.0
| +--- com.android.support:animated-vector-drawable:23.3.0
| | \--- com.android.support:support-vector-drawable:23.3.0
| \--- com.android.support:support-vector-drawable:23.3.0
+--- com.android.support:design:23.3.0
| +--- com.android.support:appcompat-v7:23.3.0
| | +--- com.android.support:animated-vector-drawable:23.3.0
| | | \--- com.android.support:support-vector-drawable:23.3.0
| | \--- com.android.support:support-vector-drawable:23.3.0
| \--- com.android.support:recyclerview-v7:23.3.0
查找gms
lib的重复并将其排除在外:
compile(group: 'com.google.android.gms', name: 'play-services-gcm', version: "8.4.0") {
exclude(group: 'com.google.android.gms', module: 'play-services-base')
exclude(group: 'com.google.android.gms', module: 'play-services-basement')
}
如果仍然无法解决问题,请告诉我
的输出./gradlew app:androidDependencies