简体   繁体   中英

java.lang.NoClassDefFoundError with Android Maven Plugin

I got my android maven plugin running today and now I want to debug my apk on a real Android Device.

When I execute

cd android-proj 
mvn clean install android:redeploy 

and start the app on my device, I stumble across this error message in the LogCat:

10-27 21:16:08.857: E/AndroidRuntime(14556): java.lang.NoClassDefFoundError: de.dornathal.planyourmeals.android.database.AndroidDBHelper$SQLiteDatabaseAdapter

However I searched for solutions and came across that some libraries were not included correctly what could cause this problem. The class AndroidDBHelper is not included by an dependency in the maven pom, because it is a nested class in 'android-proj/android-apk'. Where android-proj is the folder where Maven has 2 modules the apk and core functions.

As the AndroidManifest.xml has no direct link to AndroidDBHelper and AndroidDBHelper is the only class that knows about the SQLiteDatabaseAdapter the apk build by Maven must work at least a bit further than only calling the MainActivity.

MFG Dornathal

Okay I found out why I kept on having that issue, and for everyone who experienced the same thing:

I thought I was going to redeploy something to my device, but actually it got skipped. To use the android:deploy or android:redeploy I had to move to the exact folder in which the pom defining the apk was. As I named two folders the same name I wasn't at the right spot with my Shell.

my tree:

android-app [<--- thats where I was]
   \--- android-app [<---- thats where I should have been]
       \---target (with apk)
   \--- android-app-it (the integration test)

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