Android library project “java.lang.NoClassDefFoundError”

寵の児 提交于 2019-12-25 01:55:35

问题


Ok, first of all, I know, that many users asked this question many times in stackoverflow. I looked through all possible solutions, but still have problem.

The problem:

My IDE: Eclipse Standard/SDK

Version: Kepler Release Build id: 20130614-0229

I have an android library project, called mb-fw-android. In this project properties -> android -> Is Library - checked;

I have another project called mb-revise-android, an it needs to use mb-fw-android. I'v tried :

1) Go to mb-revise-android -> properties -> Android -> add android library -> start projec

Result is:

02-26 12:04:19.960: E/dalvikvm(11678): Could not find class 'ru.tsi.maksbm.android.config.AndroidFilePropsIOProvider', referenced from method ru.tsi.maksbm.android.revise.model.Model.<init>
02-26 12:04:19.976: E/AndroidRuntime(11678): FATAL EXCEPTION: main
02-26 12:04:19.976: E/AndroidRuntime(11678): java.lang.NoClassDefFoundError: ru.tsi.maksbm.android.config.AndroidFilePropsIOProvider
02-26 12:04:19.976: E/AndroidRuntime(11678):    at ru.tsi.maksbm.android.revise.model.Model.<init>(Model.java:117)
02-26 12:04:19.976: E/AndroidRuntime(11678):    at ru.tsi.maksbm.android.revise.model.Model.createInstance(Model.java:64)
02-26 12:04:19.976: E/AndroidRuntime(11678):    at ru.tsi.maksbm.android.revise.ReviseStartActivity.onCreate(ReviseStartActivity.java:70)
...

2) add android library project as a classic depencency project. mb-revise-android -> properties -> buildPath -> project -> add, then order and export -> check mb-fw-android project

Still the same error

3) Uncheck mb-fw-android IsLibrary checkbox, and try (2). The same result

4) Uncheck mb-fw-android IsLibrary checkbox, execute it like .apk, go to /bin folder and find mb-fw-android.jar. Paste this .jar to mb-revise-android "libs" folder, and mark "order and export" Android Private Libraries as checked.

The same result.

Summary: i've tried to add android library project as .jar, as classic dependency project and as properties -> android -> add android library, mark order and export as checked, when possible, but still not working.

Please help me, if you know solution. I use Android SDK Platform-tools 19.0.1 and Android SDK Build-tools 19.0.2

Thank you.

Wow, I just find soluiton.

We can see there http://developer.android.com/tools/sdk/eclipse-adt.html#notes one interestiong thing about ADT 20.0.0 and higher:

Build System

Added automatic merging of library project manifest files into the including project's manifest. Enable this feature with the manifestmerger.enabled property.

I've tried to add "manifestmerger.enabled=true" to my project.properties file and all is done. The thing is that builder doesn't merge my library project manifest with apk project manifest


回答1:


try importing the library project to the work space. Go to your project rightclick->properties->Android scroll down. In library add you library project



来源:https://stackoverflow.com/questions/22035746/android-library-project-java-lang-noclassdeffounderror

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!