NoClassDefFoundError - Eclipse 和 Android [英] NoClassDefFoundError - Eclipse and Android

查看:36
本文介绍了NoClassDefFoundError - Eclipse 和 Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试运行 Android 应用程序时遇到问题,该应用程序在向其构建路径添加第二个外部库之前一直运行良好.自从添加了 scoreninja jar 之后,当我尝试运行应用程序时,我现在会遇到 NoClassDefFoundError.

I'm having a problem trying to run an Android app which, up until adding a second external library to its build path, was working fine. Since having added the scoreninja jar, I now get a NoClassDefFoundError when I try to run the app.

这里是消息:

02-11 21:45:26.154: ERROR/AndroidRuntime(3654): java.lang.NoClassDefFoundError: com.scoreninja.adapter.ScoreNinjaAdapter

由于所有构建脚本都是由 Android 工具 (?) 生成的,我不确定除了清理和重建或重新启动 eclipse 之外我还能做什么(我已经尝试了所有三个).有谁知道我该如何修改?

As all of the build scripts are generated by the Android tools (?), I'm not sure what else I can do other than cleaning and rebuilding or restarting eclipse (I have already tried all three). Does anyone know how I can amend this?

推荐答案

我在更新 ADT 后遇到了这个问题.

I had this problem after updating ADT.

我将所有 JAR 文件存储在一个名为lib"的文件夹中,并以正常的 Eclipse 方式将 jar 添加到构建路径中.在我更新之前,这一切正常.

I was storing all of my JAR files in a folder called "lib" and adding the jars to the build path the normal Eclipse way. This worked fine until my update.

更新后,我收到了一个类的 NoClassDefFoundError,我可以清楚地看到包含在 jar 中的类(查看 ReferencedLibraries 类).

After my update, I was getting the NoClassDefFoundError for a class that I could clearly see was included in the jar (checking out the ReferencedLibraries classes).

解决方案是从构建路径中删除我的 jar 并将我的lib"文件夹重命名为libs".这是一个 ant 约定,似乎是新 ADT 在 .apk 文件中查找和包含库的方式.完成此操作后,一切正常.

The solution was to remove my jars from the build path and rename my "lib" folder to "libs". This is an ant convention, and seems to be the way the new ADT finds and includes libraries in an .apk file. Once I did this, everything worked fine.

这篇关于NoClassDefFoundError - Eclipse 和 Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆