简体   繁体   中英

Android library project “java.lang.NoClassDefFoundError”

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM