1. Execution failed for task ':app:processDebugResources'. > java.io.IOException: Could not delete path
解決辦法:刪除自己項目app→build下的intermediates文件夾(這個可自動生成歧沪,放心),clear一下。
2. app:transformDexArchiveWithExterLibsDexMergeForDebug
這個問題是在studio升級到3.0時出現(xiàn)的,原因是jar是引用重復榜田、沖突導致
解決辦法:
1.先檢查一下自己的libs文件的jar包和build.gradle中引用的jar有沒有重復的例如:compile 'com.squareup.retrofit2:converter-gson:2.3.0'和compile files('src/main/libs/gson-2.8.0.jar')就是沖突的宋雏,去掉其中一個懈凹,build一下瘾带,運行成功膏执。(這是我自己使用成功的方法)
2.在網(wǎng)上找到的一個解決方法是刪除.gradle文件夾驻售,然后clear一下,運行成功更米。
3. java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
這個問題的出現(xiàn)是activity的onSaveInstaceState()調(diào)用時機不準確導致
解決辦法:
1.重寫onSaveInstaceState方法欺栗,去掉super調(diào)用,但這樣可能在某些情況下不適用征峦,那么就用到方法2迟几。
2.將原來FragmentTransaction調(diào)用commit()的地方改為commitAllowingStateLoss(),具體原因在BackStackRecord里面的commitInternal()里栏笆,有心的話可以看一看类腮。
4. androidstudio 3.0 編譯build錯誤:Unable to load class ‘org.gradle.api.internal.component.Usage’.
解決辦法
buildscript {
repositories {
jcenter()
google()
}
dependencies {
...
classpath 'com.novoda:bintray-release:0.5.0'//修改此處版本號為 0.5.0---修改之前是0.3.4
...
}
}
5. Error:Execution failed for task ':app:transformClassesWithInstantRunForDebug'.
6. java.lang.IllegalStateException: Cannot add header view to list -- setAdapter has already been called.
錯誤的出現(xiàn)是因為在list.setAdapter之后又調(diào)用了addHeardView