访问库项目的类时,NoClassDefFoundError

时间:2012-04-11 11:44:47

标签: android eclipse noclassdeffounderror android-library

我已经通过在其android属性中将'Is Library'设置为true,将现有的android项目(比如App1)转换为使用eclipse的android库项目。 然后在我的另一个项目(比如App2)中,我通过在其库引用中添加App1,使用eclipse添加了这个库项目。 在App2中,我尝试启动App1的活动。 我在App2的清单文件中提到了这个活动。

Intent intent = new Intent(TestActivity.this, ForYouActivity.class);
TestActivity.this.startActivityForResult(intent, 1);

但是当我运行应用程序时,我收到错误

E/AndroidRuntime(2489): java.lang.NoClassDefFoundError: com.test.activities.ForYouActivity

请帮我解决这个问题。 提前致谢

1 个答案:

答案 0 :(得分:0)

确保您的库项目.jar文件位于“Android Dependencies”文件夹中。 我之前回答过类似的问题,它可能会对您有所帮助:https://stackoverflow.com/a/9820881/518949