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中配置下面的代碼,原因是引用了多個(gè)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 --> 查找到所有引用該類的類,這些類即為引起沖突的類
去掉本工程中g(shù)radle中用于引用有沖突的包的代碼或者將沖突的代碼從jar包或aar包中移除,確保一個(gè)module中只引用了一份相同的第三方包
3.project sturcture和Project Structure 無(wú)論是按快捷鍵或者是從files中打開都不顯示
event log中報(bào):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)
解決辦法:先看一下系統(tǒng)配置的SDK的位置和Android Studio所用的路徑是否一致,如果不一致重新配置系統(tǒng)的SDK路徑或者是重新修改Android Studio的SDK路徑
通過(guò)SDK Manager刪除掉google API23
如果解決不了,卸載android studio -->重新安裝 ,還有問(wèn)題點(diǎn)擊File --> Invalidate Cashes/Restart --> Invalidate and Restart,解決不了繼續(xù)通過(guò)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
項(xiàng)目中有錯(cuò),無(wú)法刪除這個(gè)文件夾下面的文件。手動(dòng)刪除debug文件夾或某工具粉碎即可(補(bǔ)充與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
應(yīng)該是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.
8.
注: E:\as_workspaces\DJIgo\tongyan-djigo-lib\src\main\java\com\tongyan\lib\djigo\ui\view\ControlMoveView.java使用或覆蓋了已過(guò)時(shí)的 API。
注: 有關(guān)詳細(xì)信息, 請(qǐng)使用 -Xlint:deprecation 重新編譯。 android studio-File->Project Structure->Android sdk location(路徑應(yīng)該不正確)
9.
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> java.io.FileNotFoundException: E:\as_workspaces\TYSubway\app\libs\pushservice-4.5.6.88.jar (系統(tǒng)找不到指定的文件。)
需要把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造成的以下問(wèn)題,需要用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
項(xiàng)目中有錯(cuò)
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中仔細(xì)找是否有相同的jar包
14.
Error:Execution failed for task ':app:clean'.
> Unable to delete directory: E:\as_workspaces\DJIGO_FLY\app\build\outputs\apk
無(wú)法刪除這個(gè)文件夾下的文件,到目錄下面就知道了。
15.
關(guān)于R文件無(wú)法引入,導(dǎo)致很長(zhǎng)時(shí)間無(wú)法找到錯(cuò)誤的根源。比如:如果錯(cuò)誤在A類里面發(fā)生,但是Message里提示的是B類的R文件無(wú)法引入。
這樣你就要用排除法,就像做選擇題,要將B類的問(wèn)題先注釋掉,A類里面的問(wèn)題才會(huì)暴露出來(lái)。
16. 2016-07-04

關(guān)于該問(wèn)題,需要注意的是。有時(shí)候雖然有個(gè)紅叉但是也能運(yùn)行,可能as校驗(yàn)導(dǎo)致該問(wèn)題。另外如果代碼中沒(méi)有什么問(wèn)題時(shí),就需要查看下AndroidManifest.xml是否有錯(cuò)誤,一般情況下是這個(gè)原因?qū)е?。只要知道這個(gè)即可。
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
按照上面的說(shuō)明,不能刪除這個(gè)目錄,你就手動(dòng)刪除下
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 像這樣不能刪除文件,你就找這個(gè)這個(gè)文件夾刪除掉,如果不能刪除就粉碎掉。官網(wǎng)的錯(cuò)誤提示還是比較傻瓜式的,他讓你干嘛,你就干嘛就行了。
19.2016-07-18
20.2016-09-14
當(dāng)Model中的代碼無(wú)法生產(chǎn)R文件,可以做如下操作,但前提是包中的xml、java代碼無(wú)沖突(保證之前盡量多clean,然后查看Message)。

21.2016-09-16
當(dāng)發(fā)生如下問(wèn)題時(shí)

1.將下圖中的配置改成你AS中能編譯項(xiàng)目中配置行即可

2.如下圖中的地方也需要注意下(就是講目前你as中能正常運(yùn)行的項(xiàng)目中的配置替換成這句distributionUrl-更新于20160920)

22.2016-09-23
EditText: layout tag was TextView [WrongViewCast]
場(chǎng)景:代碼運(yùn)行、clean、編譯都沒(méi)問(wèn)題,在手機(jī)上運(yùn)行也沒(méi)問(wèn)題,但是使用簽名以后就曝該錯(cuò)誤。怎么折騰都不行,但是前提是所有代碼都是正確的View的類型轉(zhuǎn)換完全正確。
解決:AActivity在app包下面,但是layou布局在另外一個(gè)Library(下稱B包)中,在解決問(wèn)題的過(guò)程中猜想可能是這個(gè)問(wèn)題導(dǎo)致,最后將B包中本屬于app包下面的布局文件移至app包下面就解決了該問(wèn)題。
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"
Fix plugin version and sync project
Open File

將該處的配置改成目前能使用的項(xiàng)目的配置
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
該問(wèn)題是由于libs導(dǎo)入的v4包版本有問(wèn)題,后來(lái)改成下面就可以了
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'
}