NoClassDefFoundError的外部库项目为Android [英] NoClassDefFoundError on external library project for Android

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

问题描述

我用eclipse的谷歌Android的发展。

I use eclipse for Google Android development.

我创建了一个库项目( [X]是库在Android的设置),它包括一个外部的jar文件(引用的库)。该库项目将在另一个项目中引用(其中会使用到库项目实际工程)。这是通过在Android的设置中添加该项目完成的。

I've created a library project ([x] Is Library in the Android-settings), which includes an external jar-file (Referenced Libraries). This library project are referenced in another Project (the actual project which will use the library project). This is done by add the project under the Android-settings.

在源代码编译,但如果我要在设备上执行它,我得到了NoClassDefFoundError的一类,它是包括在库项目的jar文件里面

the source compiles but if I want to execute it on the device, I get the NoClassDefFoundError for a class which is inside the jar-file which is included in the library project.

编辑:的JAR文件IST添加到导出的条目( [X] my.jar 订单和出口 -Tab从库中的项目)

The jar-file ist added to the exported entries ([x] my.jar on the Order and Export-Tab from the library project)

有没有干净的方式来得到这个工作?

Is there a clean way to get this working?

推荐答案

它已经在offcial API已经明确说明的这里

It has been clearly stated in offcial API here:

一个库项目可以包括JAR库

A library project can include a JAR library

您可以开发一个库项目,本身包括JAR库,但您需要手动编辑相关的应用程序项目的构建路径,添加的路径JAR文件

You can develop a library project that itself includes a JAR library, however you need to manually edit the dependent application project's build path and add a path to the JAR file

罐子LIB必须手动添加到相关的应用程序项目的构建路径,不仅是库项目构建路径本身。

The jar lib must be manually added to the dependent application project's build path, not only the library project build path itself.

从SDK R17更新:

这是自动ADT处理现在,检查出ADT 17.0.0版本新功能在这里

This is automatically handled by ADT now, check out new feature for ADT 17.0.0 release here:

新增功能自动安装JAR依赖。在/ libs文件夹中所有.jar文件添加到构建配置(类似于Ant构建系统的工作原理)。此外,需要的库项目.jar文件也会被自动添加到依赖这些库项目的项目。 (更多信息

Added feature to automatically setup JAR dependencies. Any .jar files in the /libs folder are added to the build configuration (similar to how the Ant build system works). Also, .jar files needed by library projects are also automatically added to projects that depend on those library projects. (more info)

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

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