简体   繁体   English

引用Android库项目错误

[英]Referencing Android Library Project Error

I am having issues getting my project that references an Android Library to compile. 我遇到引用要编译的Android库的项目时遇到问题。 I have exactly followed the instructions in the documentation here: http://developer.android.com/tools/projects/projects-eclipse.html 我已严格按照此处文档中的说明进行操作: http : //developer.android.com/tools/projects/projects-eclipse.html

My android library is is marked as a library correctly, and I can see the jar file and all my .class files in my project. 我的android库被正确标记为一个库,并且我可以在项目中看到jar文件和所有.class文件。 But the classes are not found when I try to reference them in my new project and it will not compile. 但是,当我尝试在新项目中引用它们时,找不到这些类,并且该类不会编译。 What am I doing wrong? 我究竟做错了什么?

Here is a screenshot (SoundGraphingLibrary is my library project and SoundGraphingLibrary is the project I need to use the library in): 这是屏幕截图(SoundGraphingLibrary是我的库项目,SoundGraphingLibrary是我需要在其中使用库的项目):

在此处输入图片说明

确保项目和库项目在同一文件夹中。

First, run Project->Clean on the library, then your project as @iagreen suggests. 首先,在库上运行Project->Clean ,然后按照@iagreen的建议运行您的项目。 Then go ahead and close and reopen eclipse. 然后继续关闭并重新打开Eclipse。 Wait for everything to build. 等待一切建立。

Assuming nothing is better at this point, click on the library and do Project->Properties->Android . 假设此时没有更好的选择,请单击库并执行Project->Properties->Android Confirm that Is Library is checked. 确认已选中“ Is Library Now, delete any instance of the library *.jar in your project. 现在,删除项目中库* .jar的任何实例。 Do Project->Properties->Android on your project. 在您的项目上执行Project->Properties->Android Click Add... and click on the library you want, OK , Apply , OK . 单击Add... ,然后单击所需的库, OKApplyOK

That should do it. 那应该做。 Also, fire lemurs. 另外,火狐猴。

Not sure if this helps but i did the following 不知道这是否有帮助,但我做了以下工作

  • Remove and adding the library by going to Project->Properties->Android. 通过转到Project-> Properties-> Android删除并添加库。
  • Clear the project by going to Project->Clean 通过转到Project-> Clean清除项目
  • Restart Eclipse and tata it works. 重新启动Eclipse并运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM