簡體   English   中英

關於Retrofit和GSON的java.util.zip.ZipException

[英]java.util.zip.ZipException on Retrofit and GSON

嗨,我收到此錯誤

錯誤:任務':app:transformClassesWithJarMergingForDebug'的執行失敗。 com.android.build.api.transform.TransformException:java.util.zip.ZipException:重復條目:com / google / gson / annotations / Expose.class

當我將改裝的GSON轉換器添加到我的gradle中時,這是我的gradle。

dependencies {
  compile fileTree(include: ['*.jar'], dir: 'libs')
  compile files('libs/GenAsync.1.2.jar')
  compile files('libs/gson-2.2.4.jar')
  compile files('libs/KGJsonConverter.jar')
  compile files('libs/MD5Simply.jar')
  compile files('libs/PhotoUtil.jar')
  compile files('libs/android-viewbadger.jar')
  compile 'com.squareup.retrofit2:converter-gson:2.1.0'
  testCompile 'junit:junit:4.12'
  compile files('libs/retrofit-2.1.0.jar')
}

你可以幫我解決我的問題嗎? 謝謝

com.google.gson.annotations.Expose類在多個依賴項中定義。 您需要排除或刪除沖突的依賴項。

例如。 com.squareup.retrofit2:converter-gson:2.1.0已經包含傳遞依賴com.google.code.gson:gson:2.7所以沒有必要聲明也compile files('libs/gson-2.2.4.jar')

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM