我的android编程环境是Ubuntu1204+Eclipse(Juno)。
使用root权限启动eclipse并修改过工程源码以后,保存了一下,eclipse会自动对工程进行编译。
之后,再使用我平时编程使用的账户打开工程的时候,莫名其妙工程会报错,但是错误并不出现在源码中的任何位置,只是执行的时候才告诉你工程有错误,无法执行。
“Your project contains error(s),please fix them before running your application.”
最后,东翻西看。在【Problems】栏里面发现了下面一句:
The project was not built due to "Could not delete '/MyProject/bin/classes/com'.". Fix the problem, then try refreshing this project and building it since it may be inconsistent.
第一反映就是之前root权限打开工程的时候,eclipse自动编译,将该工程的输出目录所有者自动提为了root权限。
首先一路cd,进入上述该路径的classes/,然后ls -l
果然显示
drwxr-xr-x 3 root root 4096 9月 30 09:27 com
解决起来就简单了,执行一下:
sudo chown -R tinyeyeser:tinyeyeser com
再回到eclipse,就可以正常修改执行工程了。