我正在尝试编译我提取的github的应用程序。该项目可能是用eclipse完成的,但我试图通过命令行使用ant debug
来完成。但是对R类中符号的所有引用都没有得到识别,我得到的错误是:
[javac] /home/ojs/tolvur/forritun/java/heklapunch/src/is/heklapunch/MainActivity.java:25: error: cannot find symbol
[javac] setContentView(R.layout.activity_main);
[javac] ^
[javac] symbol: variable activity_main
[javac] location: class layout
[javac] /home/ojs/tolvur/forritun/java/heklapunch/src/is/heklapunch/MainActivity.java:28: error: cannot find symbol
[javac] editBox = (EditText) findViewById(R.id.saved_name);
[javac] ^
[javac] symbol: variable saved_name
[javac] location: class id
[javac] /home/ojs/tolvur/forritun/java/heklapunch/src/is/heklapunch/MainActivity.java:60: error: cannot find symbol
[javac] menuInflater.inflate(R.menu.main_menu, menu);
[javac] ^
[javac] symbol: variable main_menu
[javac] location: class menu
[javac] /home/ojs/tolvur/forritun/java/heklapunch/src/is/heklapunch/MainActivity.java:98: error: cannot find symbol
[javac] case R.id.main_test:
[javac] ^
[javac] symbol: variable main_test
[javac] location: class id
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 4 errors
BUILD FAILED
/home/ojs/tolvur/forritun/java/android-sdk-linux/tools/ant/build.xml:705: The following error occurred while executing this line:
/home/ojs/tolvur/forritun/java/android-sdk-linux/tools/ant/build.xml:718: Compile failed; see the compiler error output for details.
R.java文件存在且符号在其中,所以这里有什么问题?我没有导入android.R(它是在上游导入但我在第一次收到此错误后将其注释掉了。)
我没有更改源代码,除了注释掉android.R的导入并使用android update project --target 4 --path .
构建build.xml文件
非常欢迎所有想法。
== EDIT1 ==
我正在尝试构建的应用是https://github.com/robotis/heklapunch
== EDIT2 ==
在项目上运行lint会在xml中生成19个错误和40个警告我想这可能是相关的: - )
== EDIT3 ==
更新我的SDK(首先执行android update sdk -u
,然后android update sdk -u --filter tools,platform-tools
,但仍未安装构建工具,最后android sdk
并选择build tools
进行安装)并获取git项目再次解决了我的问题。我不知道出了什么问题。