I have an Android application with a required Java project in its build path. However, its throwing a NoClassDefFoundError at runtime, much like in the case of a misconfigured "lib" folder.
Is there any way to include this project on the build path without causing runtime errors?
I know I could just use it as an external jar, but I'd strongly prefer it to be another project on the application's build path. This way I can avoid the hassle of recompiling the jar every time I make a little change to it.
Here's the exact logcat message I'm getting:
11-09 20:06:00.871: E/AndroidRuntime(1699): FATAL EXCEPTION: main
11-09 20:06:00.871: E/AndroidRuntime(1699): java.lang.NoClassDefFoundError: reproducers.SelectionReproducer
11-09 20:06:00.871: E/AndroidRuntime(1699): at com.gamma.MainActivity.onCreate(MainActivity.java:37)
11-09 20:06:00.871: E/AndroidRuntime(1699): at android.app.Activity.performCreate(Activity.java:5008)
11-09 20:06:00.871: E/AndroidRuntime(1699): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
11-09 20:06:00.871: E/AndroidRuntime(1699): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
11-09 20:06:00.871: E/AndroidRuntime(1699): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
11-09 20:06:00.871: E/AndroidRuntime(1699): at android.app.ActivityThread.access$600(ActivityThread.java:130)
11-09 20:06:00.871: E/AndroidRuntime(1699): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
11-09 20:06:00.871: E/AndroidRuntime(1699): at android.os.Handler.dispatchMessage(Handler.java:99)
11-09 20:06:00.871: E/AndroidRuntime(1699): at android.os.Looper.loop(Looper.java:137)
11-09 20:06:00.871: E/AndroidRuntime(1699): at android.app.ActivityThread.main(ActivityThread.java:4745)
11-09 20:06:00.871: E/AndroidRuntime(1699): at java.lang.reflect.Method.invokeNative(Native Method)
11-09 20:06:00.871: E/AndroidRuntime(1699): at java.lang.reflect.Method.invoke(Method.java:511)
11-09 20:06:00.871: E/AndroidRuntime(1699): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
11-09 20:06:00.871: E/AndroidRuntime(1699): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
11-09 20:06:00.871: E/AndroidRuntime(1699): at dalvik.system.NativeStart.main(Native Method)
I discovered the answer as I was typing this, but to a noob like myself, it wasn't very obvious. So, I'll still ask the question and post the solution too. Hope this helps!
The solution was to configure the required project as being "exported," which can be done in Eclipse like so:
Step 4 marks the project as being "exported." This means that it's visible to projects that require THIS project, and for some reason, this makes ADT happy.
On a side note, my version of Eclipse (Helios) doesn't even display what the checkbox does-- I had to look it up on the official Eclipse documentation .
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.