Omar Muhammad Omar Muhammad - 9 months ago 37
Android Question

Android Proguard problems(duplicate) when adding Facebook sdk & Google Firebase sdk

It builds ok but when I run it gets this error:
it didn't happen until I add firebase

Warning:Exception while processing task java.io.IOException: Can't write [/var/android_projects/Aflam/Aflam/app/build/intermediates/transforms/proguard/debug/jars/3/1f/main.jar] (Can't read [/home/omar/.android/build-cache/7b35109bbea465da27464678b5f699568c4204d8/output/jars/classes.jar(;;;;;;**.class)] (Duplicate zip entry [classes.jar:com/google/android/gms/internal/zzw$zza.class]))


Proguard rules:
{

-keep class org.apache.http.** { *; }
-keep class com.google.android.gms.**

-dontwarn com.google.android.gms.**
-dontwarn com.google.ads.**
-dontwarn org.apache.http.**
-dontwarn android.net.**

-dontnote com.google.android.gms.**
-dontnote org.apache.http.**
-dontnote com.android.net.http.**
-dontnote android.net.**


}

dependencies {

//compile fileTree(dir: 'libs', include: ['*.jar'])
//testCompile 'junit:junit:4.12'
compile ('com.facebook.android:audience-network-sdk:4.+') {
exclude module: 'bolts-android'
exclude module: 'support-v4'
}
compile(name:'unity-ads',ext:'aar')
compile 'com.codemybrainsout.rating:ratingdialog:1.0.7'
compile 'com.google.firebase:firebase-core:10.2.0'
compile 'com.google.firebase:firebase-messaging:10.2.0'


}

Answer Source

It seems that play-services-ads has version 8.4.0 in audience-network-sdk module with dependencies to com.google.android.gms of lower version, exclude play-services-ads and add play-services-ads:10.2.0 afterwards :

dependencies {
    compile ('com.facebook.android:audience-network-sdk:4.+') {
        exclude module: 'play-services-ads'
    }
    compile(name:'unity-ads',ext:'aar')
    compile 'com.codemybrainsout.rating:ratingdialog:1.0.7'
    compile 'com.google.firebase:firebase-core:10.2.0'
    compile 'com.google.android.gms:play-services-ads:10.2.0'
}