Android異常和工具使用筆記
1、r文件找不到
去你的工程目錄下,手動的把gen刪掉,然后去project中刷新一下,在編譯看看。以前遇到過類似的問題,實在不行就把你的eclispe,adt升級到最新的版本吧
抓住那么一點點線索,就要去深入探索。
2、Android Studio尋找錯誤日志的關鍵部分
比如
紅色那一堆并不是什么錯誤!
當引入的所有包超過了65536個方法將會引發這個奇葩的異常
AGPBI: {"kind":"simple","text":"com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536","sources":[{}]}
解決的方案
http://stackoverflow.com/questions/30641656/build-failure-on-android-studio
http://www.cnblogs.com/yeahgis/p/4660873.html
3、如果報錯一個組件沒有引用,那估計是因為某些包里面用到了
原來是com.google.android.gms:play-services:8.4.0用到了appcompat-v7真是一個大坑啊
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Error:A problem occurred configuring project ':xxxxx'.
> Could not resolve all dependencies for configuration ':xxxxx:_debugCompile'.
> Could not find com.android.support:appcompat-v7:23.0.0.
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.pom
https://jcenter.bintray.com/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.aar
file:/D:/xxxxxx/Android/sdk/extras/google/m2repository/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.aar
Required by:
sdk:mpaylib:unspecified > com.google.android.gms:play-services:8.4.0 > com.google.android.gms:play-services-cast:8.4.0 > com.android.support:mediarouter-v7:23.0.0
?
4、需要ndk來編譯c++的文件
D:\xxxxxxx\build.gradle
ndk {
moduleName "com_xxxxx"
}
Error:(11, 1) A problem occurred evaluating project ':xxxxxx'.
> Error: NDK integration is deprecated in the current plugin. Consider trying the new experimental plugin. For details, see http://tools.android.com/tech-docs/new-build-system/gradle-experimental. Set "android.useDeprecatedNdk=true" in gradle.properties to continue using the current NDK integration.
Error:Execution failed for task ':codeScanner:compileDebugNdk'.
> NDK not configured.
Download the NDK from http://developer.android.com/tools/sdk/ndk/.Then add ndk.dir=path/to/ndk in local.properties.
(On Windows, make sure you escape backslashes, e.g. C:\\ndk rather than C:\ndk)
下載ndk
http://developer.android.com/ndk/downloads/index.html#download
5、應用版本號太低了,安裝錯誤,無法覆蓋原來的
installation error: install_failed_version_downgrade
6、兩個一樣名字的jar包,但是md5值不一樣造成沖突
the type android.support.v4.app.fragment cannot be resolved. it is indirectly referenced from required .class files
看錯誤日志就清楚了
7、android的項目可以導出只包含jar包和資源的android項目
jar包不能包含資源,只是一個類庫
8、導入的方法太多
[2014-11-26 16:13:03 - Dex Loader] Unable to execute dex: method ID not in [0, 0xffff]: 65536
[2014-11-26 16:13:03 - TM_client] Conversion to Dalvik format failed: Unable to execute dex: method ID not in [0, 0xffff]: 65536
9、Eclipse的開發環境
如果要把項目編譯為library,要勾選is library才能讓其他的項目工程引用
中文亂碼,改成utf8編碼
顯示空格換行符號
eclipse-window-general-editers-text editors-show whitesspace characters
10、這個問題好像是文件編碼的問題
Project has no project.properties file! Edit the project properties to set one.
刪掉項目工程再重新加入一次