1

Within Eclipse, everything works perfectly when I run 'mvn install android:deploy'...however, this takes about 18 seconds to complete. Is there a faster way to launch my android application. When I try to run my main Activity via 'Android Application' I get a huge stack trace:

 09-05 14:03:09.915: E/AndroidRuntime(689): FATAL EXCEPTION: main
09-05 14:03:09.915: E/AndroidRuntime(689): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.soraapps.android.purseprideapp/com.soraapps.android.purseprideapp.PursePrideActivity}: java.lang.ClassNotFoundException: com.soraapps.android.purseprideapp.PursePrideActivity in loader dalvik.system.PathClassLoader[/data/app/com.soraapps.android.purseprideapp-2.apk]
09-05 14:03:09.915: E/AndroidRuntime(689):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569)
09-05 14:03:09.915: E/AndroidRuntime(689):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
09-05 14:03:09.915: E/AndroidRuntime(689):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
09-05 14:03:09.915: E/AndroidRuntime(689):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
09-05 14:03:09.915: E/AndroidRuntime(689):  at android.os.Handler.dispatchMessage(Handler.java:99)
09-05 14:03:09.915: E/AndroidRuntime(689):  at android.os.Looper.loop(Looper.java:123)
09-05 14:03:09.915: E/AndroidRuntime(689):  at android.app.ActivityThread.main(ActivityThread.java:3683)
09-05 14:03:09.915: E/AndroidRuntime(689):  at java.lang.reflect.Method.invokeNative(Native Method)
09-05 14:03:09.915: E/AndroidRuntime(689):  at java.lang.reflect.Method.invoke(Method.java:507)
09-05 14:03:09.915: E/AndroidRuntime(689):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
09-05 14:03:09.915: E/AndroidRuntime(689):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
09-05 14:03:09.915: E/AndroidRuntime(689):  at dalvik.system.NativeStart.main(Native Method)
09-05 14:03:09.915: E/AndroidRuntime(689): Caused by: java.lang.ClassNotFoundException: com.soraapps.android.purseprideapp.PursePrideActivity in loader dalvik.system.PathClassLoader[/data/app/com.soraapps.android.purseprideapp-2.apk]
09-05 14:03:09.915: E/AndroidRuntime(689):  at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
09-05 14:03:09.915: E/AndroidRuntime(689):  at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
09-05 14:03:09.915: E/AndroidRuntime(689):  at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
09-05 14:03:09.915: E/AndroidRuntime(689):  at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
09-05 14:03:09.915: E/AndroidRuntime(689):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
09-05 14:03:09.915: E/AndroidRuntime(689):  ... 11 more

Here is my pom.xml: https://gist.github.com/3656482

And here is what my files look like after I try building and running the project. (see gen and bin folders) http://cl.ly/image/3Q0x052S2Z3Q

Kamilski81
  • 14,409
  • 33
  • 108
  • 161
  • 1
    `Caused by: java.lang.ClassNotFoundException: com.soraapps.android.purseprideapp.PursePrideActivity` this might give you a clue about the problem. – SERPRO Sep 05 '12 at 14:08
  • I see that, but I have no idea why it's happening cause my package and class are correct...any ideas? – Kamilski81 Sep 05 '12 at 15:50
  • Are you using library project and use classes from library project? – yorkw Sep 05 '12 at 21:37
  • It automatically picks up dependencies cause it's maven, I'm not sure what you mean exactly, is there something else I need to add in order for my src to be on the classpath? – Kamilski81 Sep 05 '12 at 21:57
  • Can you post your POM on gist or add it to the description above? – Ricardo Gladwell Sep 06 '12 at 09:12
  • Also if you're using Android Libraries, there is only partial support in m2e-android. – Ricardo Gladwell Sep 06 '12 at 09:21
  • See added gist and project screen shot above, thanks for the help. – Kamilski81 Sep 06 '12 at 13:57
  • @RicardoGladwell - any idea what it could be? – Kamilski81 Sep 07 '12 at 21:14
  • hey @Kamilski81 I'm having exactly the same problem for the command line. Did you have success? I think the android classes are not included in the apk somehow – Karussell Jan 27 '13 at 20:54
  • I had a system dependency. Removing it solved the issue for me. I cannot see this in your pom.xml. I suggest: start with a simple mavenized android project and add complexity to it (android code only and then dependency after dep). This way I figured out my problem - a bit slow but it worked ;) – Karussell Jan 27 '13 at 21:45

1 Answers1

0

Assuming you're using m2e-android, it looks as though your project isn't configuring properly. At a guess I would say its because you use variables ('${android-maven-plugin-version}') in your Android maven plugin declaration. This is a known issue:

https://github.com/rgladwell/m2e-android/issues/114

Workaround: remove the ${android-maven-plugin-version} variable. You probably should remove Maven property variables you're only referencing them once, as it makes POMs unreadable.

Ricardo Gladwell
  • 3,770
  • 4
  • 38
  • 59