2017-06-26 60 views
0

我已閱讀StackOverflow中的文章this in backendlessthisthis。但對我來說沒有任何幫助。我到處找,但在建去除compile 'com.mcxiaoke.volley:library:1.0.18'當沒有任何solution.The錯誤波紋管錯誤:android + volley庫中的任務':app:transformClassesWithJarMergingForDebug'的執行失敗

Error:Execution failed for task ':app:transformClassesWithDexForDebug'. 

com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/android/volley/VolleyError;

在的build.gradle

dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
    exclude group: 'com.android.support', module: 'support-annotations' 
}) 
compile 'com.android.support:appcompat-v7:25.3.1' 
compile 'com.android.support.constraint:constraint-layout:1.0.2' 
testCompile 'junit:junit:4.12' 
compile 'com.android.support:appcompat-v7:25.3.1' 
androidTestCompile 'com.mcxiaoke.volley:library:1.0.18' 
compile project(":volley") 
compile 'com.mcxiaoke.volley:library:1.0.18' 

}

此錯誤將消失.gradle。

我需要做的是傳遞應用程序和服務器(本地主機)內的數據。傳遞字符串我使用JSON。在Android應用程序中使用Volley庫。

我會錯過什麼?謝謝

+0

請提供[mcve]。這將包括'build.gradle'文件,或者至少是所有的'dependencies',都會觸發這個構建錯誤。另外,請詳細解釋**「什麼JSON不像以前完成流動」的意思。 – CommonsWare

+0

我編輯了我的問題並感謝您的關注@CommonsWare –

+0

爲什麼你有一個Volley庫模塊*和*過時的依賴關係?使用官方依賴而不是這兩者。 – CommonsWare

回答

1

I'm searching everywhere but there aren't any references

The documentation顯示,谷歌的官方排球神器通過可用:

compile 'com.android.volley:volley:1.0.0' 

用這個來代替com.mcxiaoke.volley:library:1.0.18which was published two years ago

現在,你compile project(":volley")。我不知道爲什麼。使用或者com.android.volley:volley:1.0.0compile project(":volley"),不是兩者。除非你有使用庫模塊的某些特定原因(例如,你正在分流Volley),否則我會建議使用com.android.volley:volley:1.0.0工件。

+0

非常感謝@CommonsWare。它的工作,你保存我3年的學位。 [1] –

相關問題