处理任务java.io.IOException时出现A​​ndroid异常 [英] Android Exception while processing task java.io.IOException

查看:212
本文介绍了处理任务java.io.IOException时出现A​​ndroid异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我添加了一个新的依赖项,并在尝试运行该应用程序时开始出现以下错误:

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

错误消息是:


处理任务java.io.IOException时发生异常:无法编写[/ Users / zlee / Desktop / RD / FastLemonFree / client / Android-FastLemon / app / build /intermediates/transforms/proguard/release/jars/3/1f/main.jar](无法读取[/Users/zlee/.gradle/caches/modules-2/files-2.1/com.google.code.gson /gson/2.6.1/b9d63507329a7178e026fc334f87587ee5070ac5/gson-2.6.1.jar(;;;;;; **。class)](重复的zip条目[gson-2.6.1.jar:com / google / gson / annotations / Expose.class]))

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:

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

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.**

但是请不要用!

推荐答案

依赖项中有多个依赖于 com.google.gson.annotations.Expose 的程序包。您可以通过以下更改将其从项目中添加的最后一个依赖项中排除:

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.+'

至:

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

假设 compile'c​​om.amazon.android:mobile-ads: 5。+'是依赖项的最后添加。

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

或尝试将以下内容添加到Gradle文件中:

Or try adding the following to your Gradle file:

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

这篇关于处理任务java.io.IOException时出现A​​ndroid异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆