2
我不確定該怎麼說出這個問題。Android Studio 2.0 Gradle Bug
我在兩臺機器上工作,我的電腦和我的Mac。目前我已經升級到了我的電腦上的Android Studio 2.0,以獲得所有新功能,而且它很混亂。我需要幫助。
所以發生了什麼事情是,當我嘗試運行應用程序時,gradle構建失敗。它失敗,此消息:
Executing tasks: [:app:clean, :app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources, :app:assembleDebug]
Configuration on demand is an incubating feature.
Incremental java compilation is an incubating feature.
:app:clean
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2320Library
:app:prepareComAndroidSupportAppcompatV72320Library
:app:prepareComAndroidSupportDesign2320Library
:app:prepareComAndroidSupportRecyclerviewV72320Library
:app:prepareComAndroidSupportSupportV42320Library
:app:prepareComAndroidSupportSupportVectorDrawable2320Library
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources
:app:mergeDebugResources
:app:processDebugManifest
:app:processDebugResources
:app:generateDebugSources
:app:mockableAndroidJar UP-TO-DATE
:app:preDebugUnitTestBuild UP-TO-DATE
:app:prepareDebugUnitTestDependencies
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareDebugAndroidTestDependencies
:app:compileDebugAndroidTestAidl
:app:processDebugAndroidTestManifest
:app:compileDebugAndroidTestRenderscript
:app:generateDebugAndroidTestBuildConfig
:app:generateDebugAndroidTestAssets UP-TO-DATE
:app:mergeDebugAndroidTestAssets
:app:generateDebugAndroidTestResValues UP-TO-DATE
:app:generateDebugAndroidTestResources
:app:mergeDebugAndroidTestResources
:app:processDebugAndroidTestResources
:app:generateDebugAndroidTestSources
:app:compileDebugJavaWithJavac
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:buildInfoDebugLoader
:app:transformClassesWithExtractJarsForDebug
:app:transformClassesWithInstantRunVerifierForDebug
:app:transformClassesWithJavaResourcesVerifierForDebug
:app:mergeDebugJniLibFolders
:app:transformNative_libsWithMergeJniLibsForDebug
:app:processDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/BCKEY.SF
File1: C:\Users\Andy\.gradle\caches\modules-2\files-2.1\org.bouncycastle\bcpkix-jdk15on\1.51\6c8c1f61bf27a09f9b1a8abc201523669bba9597\bcpkix-jdk15on-1.51.jar
File2: C:\Users\Andy\.gradle\caches\modules-2\files-2.1\org.bouncycastle\bcprov-jdk15on\1.51\9ab8afcc2842d5ef06eb775a0a2b12783b99aa80\bcprov-jdk15on-1.51.jar
- 嘗試: 與--stacktrace選項運行,以獲得堆棧跟蹤。使用--info或--debug選項運行以獲取更多日誌輸出。
構建失敗
總時間:15.114秒
這裏是我的依賴列表
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.google.code.gson:gson:2.5'
compile 'com.hierynomus:sshj:0.15.0'
compile 'joda-time:joda-time:2.9.1'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'com.android.support:support-v4:23.2.0'
compile 'com.android.support:design:23.2.0'
}
現在奇怪的是,如果我上運行完全相同的源代碼我的Mac很好。那麼發生了什麼?這是一個與2.0版的bug,但似乎不太可能。
如果您需要更多信息,請告訴我!
感謝
安迪
請發佈整個Gradle控制檯輸出,而不僅僅是這些行。 – CommonsWare
@CommonsWare完成 – Andy
好的,你有重複的文件,從兩個單獨的Bouncy城堡JARs。除非他們最近重新包裝,否則Bouncy Castle不推薦用於Android應用程序,因爲Android內部包含截短版的Bouncy Castle,並且您會遇到衝突。它曾經是你必須使用[Spongy Castle](https://rtyley.github.io/spongycastle/)。我首先關注這個問題,因爲它可能會將這個問題視爲一種副作用。否則,找出一個排除規則,只能結束這個文件的一個副本。 – CommonsWare