从另一个项目访问库项目中定义的类时出现异常
我在 Eclipse 中有 2 个项目。一个是库项目(基础项目),一个是将作为应用程序的免费版本发布的项目。免费项目中只有 1 个活动:LaunchActivity。其他一切都在图书馆项目中。
我尝试调试免费项目,第一次尝试引用库项目中定义的类时,我收到 java.lang.NoClassDefFoundError
。有一次,我什至无法使用免费项目中的库类,直到我进入免费项目,右键单击“属性”>“免费项目”。 Java 构建路径 > “项目”选项卡并包含库项目(尽管我认为这可以通过在“属性”>“Android”中添加库项目作为引用并添加引用来解决)。我什至尝试过“属性”>项目引用并在此处添加了库 proj 作为参考,但没有成功。
有什么想法吗?
非常非常感谢, 肖恩
I have 2 projects in Eclipse. One is a library project (the base project) and one is the project that will be released as the free version of the app. The free project has only 1 activity in it: a LaunchActivity. Everything else is in the library project.
I try to debug the free project and the 1st time I try to reference a class defined in the Library project, I get a java.lang.NoClassDefFoundError
. At one point I couldn't even use the library classes in the free project until I went on the free project, right-clicked Properties > Java Build Path > Projects tab and included the library project (although I figured this would be taken care of by adding the library project as a reference in Properties > Android and adding the reference). I have even tried Properties > Project References and added the library proj as a reference here too but without success.
Any ideas?
Many many thanks,
Sean
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您还必须将库项目的 AndroidManifest.xml 中定义的活动定义到主项目 AndroidManifest.xml 中。
并且,通过 Properties->Android->Add->Apply 包含库项目作为参考
You have to define your activities that are defined in library Project's AndroidManifest.xml into Main projects AndroidManifest.xml also.
And ,include library project as a reference through Properties->Android->Add->Apply