Problem with linking to other project in Android Eclipse environment

柔情痞子 提交于 2019-12-06 07:35:55

问题


I am developing an Android application as an Eclipse project that uses classes from another Eclipse Android project I already have. When I originally imported it (New Project > Android Project > From Existing Source), it had a bunch of errors, but when I did Project > Properties > Java Build Path and went to the projects tab and added the other project, the errors went away. Unfortunately, when I ran the application, I got the following error in DDMS:

java.lang.NoClassDefFoundError: [package name].Config
[stack trace]

Is there something I'm supposed to add to the manifest telling it to look at the other package? If so, where would that be added?

Thanks in advance


回答1:


Found the answer. It turns out that if I add the compiled class files into a JAR file using Eclipse's export command and then link to external jars in the Java Build Path, it works without having to change the Android Manifest at all.




回答2:


Try using the File -> Import...

Then go to "Existing projects into Workspace" and choose the root directory of the project. The one where are the src,res... folders




回答3:


Your second project should be a library. Open project properties, select the Android tab and check "is library".

In your main project, open its properties, select Android tab also and click on Add in the library section and add your second project.



来源:https://stackoverflow.com/questions/4980451/problem-with-linking-to-other-project-in-android-eclipse-environment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!