开发者

Problem with linking to other project in Android Eclipse environment

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 &开发者_如何转开发gt; 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


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.


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜