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.
删掉项目工程再重新加入一次