android学习笔记



android学习笔记

1、以前的android代码,放到eclipse里:Your project contains error(s), please fix it before running it.而且只有项目名上有红叉,具体代码中并无错误,依照网上一些大众意见clean,结果R.java文件被删除,而且不再生成。

查找解决办法:
(1)
首先发现的解决办法是删除debug.keystore(我的在/home/xxxx/.android中),这个自动生成的密钥只能使用一年,删除后会重新生成。我删除,问题未解决。
(2)
再找:
That usually comes from errors in the build path.
If you’re using eclipse, there is a view you can add that lists all the errors called “Problems”.

Otherwise, you can try to clean the project, and that usually solves a few problems.

Finally, if you add or alter resources from outside your IDE, you’ll want to reload the resources and clean.

EDIT (Comment by anonymous user)

This can also be caused by an out of date “Debug Certificate” fixed as follows:


IF ALL FAILS THEN THIS GOTTA BE THE SOLUTION:

Delete your debug certificate under ~/.android/debug.keystore (on Linux and Mac OS X); the directory is something like %USERPROFILE%/.androidon Windows.

The Eclipse plugin should then generate a new certificate when you next try to build a debug package. You may need to clean and then build to generate the certificate.

This is also another fix for the “setContentView(R.layout.main);” error that says it cannot find R.layout.main when it is actually generated. (R cannot be resolved to a variable).

This is also another fix for the error “Your project has errors…” and you cannot find any. Clean and rebuild are still necessary after generating a new debug certificate.

(from:http://stackoverflow.com/questions/4954316/your-project-contains-errors-please-fix-it-before-running-it)

(3)(2)中的老师提醒了我查看eclipse下的错误提示:error executing aapt. please check aapt is present at。。。。 查找后发现是adk tools的问题,我的adk tools已安装,重装,问题解决。