2016-09-28 33 views
1

我用我的應用程序和一些錯誤的改造和Okhttp都被趕了出來很好地工作,首先我排除在改造和okhttp奧基奧和GSON解決我編譯,但它無法正常工作精緻,它使帶來的誤差,每次這是錯誤:執行失敗的任務「:應用程序:transformClassesWithJarMergingForDebug」。 > com.android.build.api.transform.TransformException:java.util.zip.ZipException:重複的條目:COM /谷歌/ GSON /註釋/ Expose.class另一次它將帶來的是奧基奧作爲奧基奧/ asyncTimeout,我該如何解決這個問題?改造和Okhttp不會對我的應用

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile files('libs/mobilesec.jar') 
    compile files('libs/org-apache-commons-codec.jar') 
    compile files('libs/apache-commons-lang.jar') 
    compile files('libs/core-1.51.0.0.jar') 
    compile files('libs/gson-2.0.2.jar') 
    compile files('libs/okio-1.2.0.jar') 
    compile files('libs/sqliteassethelper-2.0.1.jar') 
    compile 'com.android.support:support-v4:21.+' 
    compile 'com.android.support:appcompat-v7:21.+' 
    compile files('libs/gcm.jar') 
    compile 'com.crittercism:crittercism-android-agent:+' 
    compile 'com.google.android.gms:play-services-wearable:6.5.87' 
    compile ('com.squareup.okhttp3:logging-interceptor:3.2.0'){ 
     exclude module: 'com.squareup.okio' 
    } 
    compile 'com.android.support:multidex:1.0.0' 

} 
+0

你真的需要的okhttp依賴。據我所知Retrofit建立在okhttp之上。 – Vall0n

+0

那麼人們通常使用Gradle來完成他們的依賴關係而不是隨機jar – EpicPandaForce

回答

0

你GSON和奧基奧罐子複製..刪除

compile files('libs/gson-2.0.2.jar') 
compile files('libs/okio-1.2.0.jar') 

但..你爲什麼要加載的依賴都通過本地的jar和遠程資源庫?我建議只使用遠程依賴關係。

編輯:您可以渲染的依賴關係樹用命令gradle dependencies。運行它並檢查爲什麼gson被添加兩次。

+0

可以請你解釋加載通過遠程存儲庫本地jar的缺點 –

+0

我正在嘗試你的答案 –

+0

錯誤:執行失敗的任務':app:transformClassesWithJarMergingForDebug 」。 > com.android.build.api.transform.TransformException:java.util.zip.ZipException:重複的條目:COM /谷歌/ GSON /註釋/ Expose.class –