zlee
zlee

Reputation: 85

Android Exception while processing task java.io.IOException

I added a new dependency and I started getting the following error when I try to run the application:

The error message is:

Exception while processing task java.io.IOException: Can't write [/Users/zlee/Desktop/RD/FastLemonFree/client/Android-FastLemon/app/build/intermediates/transforms/proguard/release/jars/3/1f/main.jar] (Can't read [/Users/zlee/.gradle/caches/modules-2/files-2.1/com.google.code.gson/gson/2.6.1/b9d63507329a7178e026fc334f87587ee5070ac5/gson-2.6.1.jar(;;;;;;**.class)] (Duplicate zip entry [gson-2.6.1.jar:com/google/gson/annotations/Expose.class]))

build.gradle:

dependencies {
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.0.0'
    compile 'org.jetbrains:annotations-java5:15.0'
    compile 'com.android.support:recyclerview-v7:24.0.0'
    compile files('libs/GoogleConversionTrackingSdk-2.2.4.jar')
    compile 'com.facebook.android:facebook-android-sdk:[4,5)'
    compile 'com.google.android.gms:play-services-ads:9.4.0'
    compile 'com.google.android.gms:play-services-analytics:9.4.0'
    compile 'cn.jiguang.sdk:jpush:3.0.0'
    compile 'cn.jiguang.sdk:jcore:1.0.0'
    compile 'com.zhy:autolayout:1.4.5'
    compile 'com.bugtags.library:bugtags-lib:latest.integration'
    compile('com.mopub:mopub-sdk-interstitial:4.9.0@aar') {
        transitive = true
    }
    compile('com.mopub:mopub-sdk-native-static:4.9.0@aar') {
        transitive = true
    }
    compile 'com.amazon.android:mobile-ads:5.+'
    compile files('libs/applovin-sdk-6.4.2.jar')
    compile files('libs/chartboost.jar')
    compile('com.twitter.sdk.android:tweet-composer:2.3.1@aar') {
        transitive = true;
    }
}

proguard-project.txt

 -keep class com.facebook.** { *; }
 -keepattributes Signature
 -dontwarn net.fortuna.ical4j.model.CalendarFactory
 -dontwarn net.fortuna.ical4j.model.**
 -keep class com.google.protobuf.** { *; }
 -dontwarn com.google.**
 -keep class com.google.gson.** {*;}
 -dontwarn org.apache.http.**
 -dontwarn android.net.http.AndroidHttpClient
 -dontwarn com.google.android.gms.**
 -dontwarn com.android.volley.toolbox.**

but it doesn't work, please!

Upvotes: 0

Views: 2791

Answers (1)

Kamran Ahmed
Kamran Ahmed

Reputation: 7761

There are multiple packages in your dependencies that depend on com.google.gson.annotations.Expose. You may exclude it from the last dependency you added in the project by changing:

compile 'com.amazon.android:mobile-ads:5.+'

to:

compile('com.amazon.android:mobile-ads:5.+', {
    exclude group: 'com.google.code.gson'
})

Assuming compile 'com.amazon.android:mobile-ads:5.+' was the last addition to your dependencies.

Or try adding the following to your Gradle file:

configurations {
    all*.exclude group: 'com.google.code.gson'
}

Upvotes: 1

Related Questions