In my Android project, I added the library to the libs folder.
This jar contains three different packages:
- google GSON (com.google.gson)
- jboss netty (org.jboss.netty)
- A client application that I developed myself that uses these two other libraries. (Com.example.core)
The box is compiled / archived using ant.
There are no errors in eclipse, but when I try to run the Android application on the device, I get the following:
E/AndroidRuntime(23807): FATAL EXCEPTION: main E/AndroidRuntime(23807): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.project/com.example.project.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.project.MainActivity" on path: /data/app/com.example.project-1.apk E/AndroidRuntime(23807): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106) E/AndroidRuntime(23807): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) E/AndroidRuntime(23807): at android.app.ActivityThread.access$600(ActivityThread.java:141) E/AndroidRuntime(23807): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) E/AndroidRuntime(23807): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime(23807): at android.os.Looper.loop(Looper.java:137) E/AndroidRuntime(23807): at android.app.ActivityThread.main(ActivityThread.java:5039) E/AndroidRuntime(23807): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime(23807): at java.lang.reflect.Method.invoke(Method.java:511) E/AndroidRuntime(23807): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) E/AndroidRuntime(23807): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) E/AndroidRuntime(23807): at dalvik.system.NativeStart.main(Native Method) E/AndroidRuntime(23807): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.project.MainActivity" on path: /data/app/com.example.project-1.apk E/AndroidRuntime(23807): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65) E/AndroidRuntime(23807): at java.lang.ClassLoader.loadClass(ClassLoader.java:501) E/AndroidRuntime(23807): at java.lang.ClassLoader.loadClass(ClassLoader.java:461) E/AndroidRuntime(23807): at android.app.Instrumentation.newActivity(Instrumentation.java:1054) E/AndroidRuntime(23807): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097) E/AndroidRuntime(23807): ... 11 more
And this is definitely my jar that causes this, because if I remove the links to it from the classes from MainActivity, then the problem will be solved and the application will start on the device.
Using apktool , I checked what happens in apk and I found that everything is added to the smali directory, that is, everything except for my package (com.example.core).
So, all the classes of applications for Android (com.example.project), gson (com.google.gson) and netty (org.jboss.netty) from my bank are, but not com.example.core.
My environment:
Eclipse 4.2.1
ADT 21.0.1
Java 7 (oracle)
Devices I tested for:
Samsung Galaxy S2
LG nexus 4
Any ideas? Thanks.
source share