transformClassesWithJarMergingForDebug

1.dexDebug ExecException finished with non-zero exit value 2 全bug日誌如下:

(Error:Execution failed for task ':app:dexDebug'. 

> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'D:\JDK8\jdk1.8.0_11\bin\java.exe'' finished with non-zero exit value 2)
需要在gradle中配置下面的代碼,原因是引用了多個libraries文件

defaultConfig {
multiDexEnabled true
}

2.Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/app/BackStackState$1.class

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/annotation/ArrayRes.class

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/android/volley/ServerError.class

原因:在所添加的jar包或aar包中也引用了support-V4,與工程中引用的相沖突
Ctrl+N --> 在搜索框中輸入BackStackState --> 查找到所有引用該類的類,這些類即爲引起衝突的類
去掉本工程中gradle中用於引用有衝突的包的代碼或者將衝突的代碼從jar包或aar包中移除,確保一個module中只引用了一份相同的第三方包

3.project sturcture和Project Structure 無論是按快捷鍵或者是從files中打開都不顯示

event log中報:IllegalArgumentException:Multiple entries with same key: Google Inc.:Google APIs:23=Google APIs (Google Inc.) (API 23) and Google Inc.:Google APIs:23=Google APIs (Google Inc.) (API 23)

解決辦法:先看一下系統配置的SDK的位置和Android Studio所用的路徑是否一致,如果不一致重新配置系統的SDK路徑或者是重新修改Android Studio的SDK路徑
通過SDK Manager刪除掉google API23
如果解決不了,卸載android studio -->重新安裝 ,還有問題點擊File --> Invalidate Cashes/Restart --> Invalidate and Restart,解決不了繼續通過SDK Manager刪除掉google API23

4.

Error:Execution failed for task ':app:clean'.
> Unable to delete directory: E:\as_workspaces\DJIgo\app\build\intermediates\res\merged\debug

項目中有錯,無法刪除這個文件夾下面的文件。手動刪除debug文件夾或某工具粉碎即可(補充與20160916)。

5.

Error:Execution failed for task ':tongyan_bugs_framework_master:processDebugAndroidTestManifest'.
> java.lang.RuntimeException: Manifest merger failed : uses-sdk:minSdkVersion 18 cannot be smaller than version 19 declared in library [DJIgo:tysubwayinspection3.0-framework:unspecified] E:\as_workspaces\DJIgo\tongyan_bugs_framework_master\build\intermediates\exploded-aar\DJIgo\ty3.0-framework\unspecified\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="com.ton.framework" to force usage

應該是Library的sdk的版本與app的sdk的版本有衝突

 6.

Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 17 cannot be smaller than version 19 declared in library [DJIgo:tongyan-djigo-lib:unspecified] E:\as_workspaces\DJIgo\app\build\intermediates\exploded-aar\DJIgo\tongyan-djigo-lib\unspecified\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="com.tongyan.lib.djigo" to force usage

7.

Error:Execution failed for task ':tongyan-djigo-lib:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

http://stackoverflow.com/questions/33404552/execution-failed-for-task-appcompiledebugjavawithjavac-in-android-studio

8.

注: E:\as_workspaces\DJIgo\tongyan-djigo-lib\src\main\java\com\tongyan\lib\djigo\ui\view\ControlMoveView.java使用或覆蓋了已過時的 API。
注: 有關詳細信息, 請使用 -Xlint:deprecation 重新編譯。 android studio-File->Project Structure->Android sdk location(路徑應該不正確)

9.

Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> java.io.FileNotFoundException: E:\as_workspaces\TYSubway\app\libs\pushservice-4.5.6.88.jar (系統找不到指定的文件。)

需要把dependencies中的lib包下面的jar包全部取消下,再添加。

10.

Error:Execution failed for task ':tysubwayinspection3.0-framework:packageReleaseResources'.
> java.io.IOException: Could not delete folder E:\as_workspaces\DJIgo\tysubwayinspection3.0-framework\build\intermediates\bundles\release\res

11.由於使用sdk5.0造成的以下問題,需要用sdk6.0

E:\as_workspaces\DJIgo\app\build\intermediates\res\merged\debug\values-v23\values-v23.xml
Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Error:(18) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'D:\Android\adt-bundle-windows-x86_64-20140702\android_sdk\build-tools\23.0.0\aapt.exe'' finished with non-zero exit value 1

12.

Error:Execution failed for task ':app:clean'.
> Unable to delete file: E:\as_workspaces\DjiGo-Demo\app\build\intermediates\exploded-aar\com.android.support\support-v4\23.3.0\jars\classes.jar

項目中有錯

13.

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/annotation/IntegerRes.class

包衝突了,在app及子library中仔細找是否有相同的jar包

14.

Error:Execution failed for task ':app:clean'.
> Unable to delete directory: E:\as_workspaces\DJIGO_FLY\app\build\outputs\apk

無法刪除這個文件夾下的文件,到目錄下面就知道了。

15.

關於R文件無法引入,導致很長時間無法找到錯誤的根源。比如:如果錯誤在A類裏面發生,但是Message裏提示的是B類的R文件無法引入。

這樣你就要用排除法,就像做選擇題,要將B類的問題先註釋掉,A類裏面的問題纔會暴露出來。

16. 2016-07-04

 

關於該問題,需要注意的是。有時候雖然有個紅叉但是也能運行,可能as校驗導致該問題。另外如果代碼中沒有什麼問題時,就需要查看下AndroidManifest.xml是否有錯誤,一般情況下是這個原因導致。只要知道這個即可。

17.2016-07-04

Error:Execution failed for task ':Tongyan_StructureCheck_Library:clean'.
> Unable to delete directory: E:\as_workspaces\TYSubwayInspectionNJ_Reconsitution\StructureCheck_Library\build\intermediates\exploded-aar

按照上面的說明,不能刪除這個目錄,你就手動刪除下

18.2016-07-15

Error:Execution failed for task ':app:clean'.
> Unable to delete directory: E:\as_workspaces\TYSubwayInspectionNJ_Reconsitution\app\build\intermediates\classes\debug\com\tongyan\nanjing\subway

Unable to delete directory 像這樣不能刪除文件,你就找這個這個文件夾刪除掉,如果不能刪除就粉碎掉。官網的錯誤提示還是比較傻瓜式的,他讓你幹嘛,你就幹嘛就行了。

19.2016-07-18

20.2016-09-14
當Model中的代碼無法生產R文件,可以做如下操作,但前提是包中的xml、java代碼無衝突(保證之前儘量多clean,然後查看Message)。
21.2016-09-16
當發生如下問題時
1.將下圖中的配置改成你AS中能編譯項目中配置行即可
2.如下圖中的地方也需要注意下(就是講目前你as中能正常運行的項目中的配置替換成這句distributionUrl-更新於20160920)
 22.2016-09-23
EditText: layout tag was TextView [WrongViewCast]
場景:代碼運行、clean、編譯都沒問題,在手機上運行也沒問題,但是使用簽名以後就曝該錯誤。怎麼折騰都不行,但是前提是所有代碼都是正確的View的類型轉換完全正確。
解決:AActivity在app包下面,但是layou佈局在另外一個Library(下稱B包)中,在解決問題的過程中猜想可能是這個問題導致,最後將B包中本屬於app包下面的佈局文件移至app包下面就解決了該問題。
23.2016-10-24

Error:(1, 0) Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to "ad3f801955f53e94516853b8f93ac2b9ee8cc4"
<a href="fixGradleElements">Fix plugin version and sync project</a><br><a href="openFile:E:\as_workspaces\PedometerDemo\app\build.gradle">Open File</a>

 

將該處的配置改成目前能使用的項目的配置

 24.2016-10-24

Error:Could not open no_initscript class cache for initialization script 'C:\Users\Rubert\AppData\Local\Temp\asLocalRepo194.gradle' (C:\Users\Rubert\.gradle\caches\2.4\scripts\asLocalRepo194_dzs652nv4687n61mc501sfben\InitScript\no_initscript).
> Failed to create directory 'C:\Users\Rubert\.gradle\caches\2.4\scripts\asLocalRepo194_dzs652nv4687n61mc501sfben\InitScript\no_initscript\classes'

 25.2016-11-01
Error:Execution failed for task ':app:transformClassesWithDexForDebug'. 
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException
 該問題是由於libs導入的v4包版本有問題,後來改成下面就可以了
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile files('libs/Volley.jar')
    compile files('libs/gson-1.7.1.jar')
    compile 'com.android.support:support-v4:22.0.0'
}

26.2016.12.26
> Cannot find System Java Compiler. Ensure that you have installed a JDK (not just a JRE) and configured your JAVA_HOME system variable to point to the according directory.

File-->Project-->Structrue-->SDK Location-->JDK location  

Use embedded JDK 前面勾去掉,指定一個JDK地址。

發佈了71 篇原創文章 · 獲贊 49 · 訪問量 49萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章