外部 .jar 文件的 Android Eclipse NoClassDefFoundError [英] Android Eclipse NoClassDefFoundError for external .jar files

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

问题描述

我遇到了一个奇怪的错误.我有一个使用外部库的 Android 项目,特别是:

I have come across a strange error. I have an Android project that uses external libraries, in particular:

  • android-support-v4.jar(用于 Android 1.6 中的 Fragment 支持)
  • GoogleAdMobAdsSdk-4.3.1.jar(用于广告)

该项目运行良好,直到我更新了插件的某些方面(无法回忆具体细节,因为我没有太注意它),之后,每当我尝试使用上述 .jar 文件中的任何类时(或它的任何子类,甚至是我定义的子类),我会得到一个 java.lang.NoClassDefFoundError.找了好久都没有找到答案,真的很郁闷.

The project ran fine until I updated some aspects of the plugin (can't recall the specifics as I did not pay too much attention to it) and after that, whenever I try to use any class from the above .jar files (or any of its subclasses, even ones defined by me), I would get a java.lang.NoClassDefFoundError. I could not find the answer after much searching, so I am really stumped.

我认为这个问题与我的 IDE 的设置方式有关,与实际代码关系不大,因此除非绝对必要,否则我不会发布任何内容.

I believe this problem is related to how my IDE is set up and it has little to do with actual code, so I will not post any unless if it's absolutely necessary.

推荐答案

你需要阅读这个 - Android 项目中的依赖处理.

You need to read this - Dealing with dependencies in Android projects.

此链接也很有用 - 带有 ADT 17 的 ClassDefNotFoundError

基本上,创建一个名为 libs 的文件夹并将所有 jar 文件放入其中.最近的更新将自动为您处理剩下的事情.您不再需要编辑您的路径.

Basically, create a folder called libs and place all of your jar files inside. The recent update will automatically take care of the rest for you. You don't need to edit your path anymore.

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

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