Android常见问题解决

来源:互联网 发布:面板数据计量经济学 编辑:程序博客网 时间:2024/06/17 05:24

1、The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object

关闭eclipse时停止响应,被强制关闭。电脑重启后出现上面这个错误。重启eclipse之后错误消失。


2、emulator-5554 disconnected!

http://jingyan.baidu.com/article/49711c6169d61dfa441b7c08.html

用方法二时要配置adb的路径到系统变量PATH

http://jingyan.baidu.com/article/17bd8e52f514d985ab2bb800.html


重启abd之后 run as就可以了。


3、build时不能生成apk

Window->Preferences -> Android -> Build中有一项“Skip packaging and dexing until export or launch....”,去除勾选状态


4、ID definitions *must* be of the form @+id/name

这个错误出现在 Lint Warnings。出错的地方都是这种方法定义的IDandroid:id=“id+foo/id”,用这种方法会在R中定义foo类。Lint说是这种定义方法是一种错误的方法,在过去的API中没有做错误处理。
Android Lint是SDK Tools 16 (ADT 16)之后才引入的工具,通过它对Android工程源代码进行扫描和检查,可发现潜在的问题,以便程序员及早修正这个问题。Android Lint提供了命令行方式执行,还可与IDE(如Eclipse)集成,并提供了html形式的输出报告。
Lint 窗口中的catagroy栏指明了错误所属的类别,在最右侧的窗口中有ID,然后在Properties->Android lint perferences,将对应的条目选择Ignore即可。

5、查看System.out.println输出的内容。
Logcat视图中显示系统的打印信息。可以加过滤器过滤关心的信息。

6、javah生成jni头文件

"Could not find class file for 'com.example.jnitest.MainActivity'"
-classpath指定的路径不对,一般是bin/classes
 cannot access android.app.Activity
需要添加android.jar的路径。
完整的命令:javah -classpath bin/classes com.example.jnitest.MainActivity:/home/zhangmc/work/ProgramFile/android-sdk-linux/platforms/android-19/android.jar

7、- error: Error: No resource found that matches the given name (at 'id' with value'@+android:id/SecondaryProgress').

android:id和@id一样是引用已有的id,@+id是新增加一个id。加上android:表示引用android.R.id里面定义的id资源。id记录在
sdk/platforms/xxxx/data/res/values/ids.xml,故打开此文件,找到你要的id值,原来发现由SecondaryProgress转换为secondaryProgress



0 0
原创粉丝点击