Java – multiple DEX files define LCOM / Google / Android / GMS / ads / identifier / advertising idclient $info;
•
Android
I received this error while trying to compile the project on Android studio
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`
Here is my build.gradle file:
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'
}
I've been trying to solve this problem. I tried to delete my playback service dependency, but it can't solve the problem. Please help me solve this problem. Thank you
resolvent:
You have duplicate dependencies - the two classes are the same. You should know which library contains the one that should be excluded. To do this, you need to run the next line in the console:
./gradlew app:androidDependencies
In addition, you can perform the same operation on the gradle plug-in in Android Studio:
The output will be as follows:
+--- 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
Find and exclude duplicates of GMS lib as follows:
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')
}
If you still can't solve the problem, please let me know
./gradlew app:androidDependencies
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码