Reputation: 11
I was trying to implement AdMob into my android project with LibGDX, and I somehow completely messed up my entire project. I think it has something to do with the libraries. I reset all of my code, but it still won't work. I am using Eclipse so I don't have gradle.
Here is my LogCat:
03-06 19:16:13.481: E/AndroidRuntime(26583): FATAL EXCEPTION: main
03-06 19:16:13.481: E/AndroidRuntime(26583): Process: com.techybite.sportsball, PID: 26583
03-06 19:16:13.481: E/AndroidRuntime(26583): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.techybite.sportsball/com.techybite.sportsball.AndroidLauncher}: java.lang.ClassNotFoundException: Didn't find class "com.techybite.sportsball.AndroidLauncher" on path: DexPathList[[zip file "/data/app/com.techybite.sportsball-1/base.apk"],nativeLibraryDirectories=[/data/app/com.techybite.sportsball-1/lib/arm, /vendor/lib, /system/lib]]
03-06 19:16:13.481: E/AndroidRuntime(26583): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3023)
03-06 19:16:13.481: E/AndroidRuntime(26583): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3294)
03-06 19:16:13.481: E/AndroidRuntime(26583): at android.app.ActivityThread.access$1000(ActivityThread.java:210)
03-06 19:16:13.481: E/AndroidRuntime(26583): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1704)
03-06 19:16:13.481: E/AndroidRuntime(26583): at android.os.Handler.dispatchMessage(Handler.java:102)
03-06 19:16:13.481: E/AndroidRuntime(26583): at android.os.Looper.loop(Looper.java:145)
03-06 19:16:13.481: E/AndroidRuntime(26583): at android.app.ActivityThread.main(ActivityThread.java:6938)
03-06 19:16:13.481: E/AndroidRuntime(26583): at java.lang.reflect.Method.invoke(Native Method)
03-06 19:16:13.481: E/AndroidRuntime(26583): at java.lang.reflect.Method.invoke(Method.java:372)
03-06 19:16:13.481: E/AndroidRuntime(26583): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
03-06 19:16:13.481: E/AndroidRuntime(26583): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
03-06 19:16:13.481: E/AndroidRuntime(26583): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.techybite.sportsball.AndroidLauncher" on path: DexPathList[[zip file "/data/app/com.techybite.sportsball-1/base.apk"],nativeLibraryDirectories=[/data/app/com.techybite.sportsball-1/lib/arm, /vendor/lib, /system/lib]]
03-06 19:16:13.481: E/AndroidRuntime(26583): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
03-06 19:16:13.481: E/AndroidRuntime(26583): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
03-06 19:16:13.481: E/AndroidRuntime(26583): at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
03-06 19:16:13.481: E/AndroidRuntime(26583): at android.app.Instrumentation.newActivity(Instrumentation.java:1094)
03-06 19:16:13.481: E/AndroidRuntime(26583): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3013)
03-06 19:16:13.481: E/AndroidRuntime(26583): ... 10 more
03-06 19:16:13.481: E/AndroidRuntime(26583): Suppressed: java.lang.NoClassDefFoundError: com.techybite.sportsball.AndroidLauncher
03-06 19:16:13.481: E/AndroidRuntime(26583): at dalvik.system.DexFile.defineClassNative(Native Method)
03-06 19:16:13.481: E/AndroidRuntime(26583): at dalvik.system.DexFile.defineClass(DexFile.java:226)
03-06 19:16:13.481: E/AndroidRuntime(26583): at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
03-06 19:16:13.481: E/AndroidRuntime(26583): at dalvik.system.DexPathList.findClass(DexPathList.java:321)
03-06 19:16:13.481: E/AndroidRuntime(26583): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
03-06 19:16:13.481: E/AndroidRuntime(26583): ... 14 more
03-06 19:16:13.481: E/AndroidRuntime(26583): Suppressed: java.lang.ClassNotFoundException: com.techybite.sportsball.AndroidLauncher
03-06 19:16:13.481: E/AndroidRuntime(26583): at java.lang.Class.classForName(Native Method)
03-06 19:16:13.481: E/AndroidRuntime(26583): at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
03-06 19:16:13.481: E/AndroidRuntime(26583): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
03-06 19:16:13.481: E/AndroidRuntime(26583): at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
03-06 19:16:13.481: E/AndroidRuntime(26583): ... 13 more
03-06 19:16:13.481: E/AndroidRuntime(26583): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
Any help is very much appreciated. This is my first libGDX project and I am learning as I go. Thank you in advance!
Upvotes: 1
Views: 470
Reputation: 656
Even though this is a bit old, this one had me scratching my head for weeks, thought I'd leave a solution here for anyone who comes across this question:
If it is your DesktopLauncher class that 'cannot be found' and throws the ClassNotFoundException
, use the same above steps BUT instead of selecting your Android project in the first step, select your Desktop project before following the steps (Sounds obvious but it had me). It's a library issue.
PS: I'm using eclipse with gradle integration.
Upvotes: 1
Reputation: 663
The cause of your problem is indeed a library problem. I've ran into this sort of problem many times when compiling my project to a runnable.
The problem in my case was either that it didn't package the library or it packaged it incorrectly so that it was unreachable. Try opening your exported apk with something like 7zip to see how the filestructure has been built up when exporting.
I suggested using cradle to re-setup this project or atleast future projects.
https://github.com/libgdx/libgdx/wiki/Project-Setup-Gradle
Upvotes: 1