The manifest is in Assets/Plugins/Android alongside OverrideExample.jar, which contains OverrideExample.class. I’m not really familiar with Android / Java development, is there something trivial I’m missing?
Here’s logcat’s output:
I/ActivityManager( 111): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.company.product/.OverrideExample } from pid 2369
I/ActivityManager( 111): Start proc com.company.product for activity com.company.product/.OverrideExample: pid=5745 uid=10054 gids={3003, 1015}
D/AndroidRuntime( 5745): Shutting down VM
W/dalvikvm( 5745): threadid=1: thread exiting with uncaught exception (group=0x40015560)
E/AndroidRuntime( 5745): FATAL EXCEPTION: main
E/AndroidRuntime( 5745): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.company.product/com.company.product.OverrideExample}: java.lang.ClassNotFoundException: com.company.product.OverrideExample in loader dalvik.system.PathClassLoader[/data/app/com.company.product-1.apk]
E/AndroidRuntime( 5745): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569)
E/AndroidRuntime( 5745): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
E/AndroidRuntime( 5745): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
E/AndroidRuntime( 5745): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
E/AndroidRuntime( 5745): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 5745): at android.os.Looper.loop(Looper.java:130)
E/AndroidRuntime( 5745): at android.app.ActivityThread.main(ActivityThread.java:3683)
E/AndroidRuntime( 5745): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 5745): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime( 5745): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/AndroidRuntime( 5745): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/AndroidRuntime( 5745): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 5745): Caused by: java.lang.ClassNotFoundException: com.company.product.OverrideExample in loader dalvik.system.PathClassLoader[/data/app/com.company.product-1.apk]
E/AndroidRuntime( 5745): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
E/AndroidRuntime( 5745): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
E/AndroidRuntime( 5745): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
E/AndroidRuntime( 5745): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
E/AndroidRuntime( 5745): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
E/AndroidRuntime( 5745): ... 11 more
W/ActivityManager( 111): Force finishing activity com.company.product/.OverrideExample
V/RenderScript_jni( 2369): surfaceDestroyed
W/ActivityManager( 111): Activity pause timeout for HistoryRecord{4051a998 com.company.product/.OverrideExample}
Hi gsibley,
Did you follow the guide step by step???
Did you add the classes.jar file to the path before you created the ‘OverrideExample.jar’???
You just weren’t talking about that part up there. I recently got followed that guide and got it working fine for me.
OK so you copied the OverrideExample.java file from the guide as well?
Usually you get this type of error if you didn’t name something correctly somewhere either in your manifest file or you java file or in the unity player settings bundle identifier.
Assuming they are all the same, that is really weird.
OK, thanks to help from Erique on IRC I’ve found out the cause of this problem: When the .class files are jar’d up they must be in a directory tree that matches the package name. So for the example, you’d have to have OverrideExample.class in the com/company/product directory, and then jar cf OverrideExample.jar com to package the whole directory.
“java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.nextwave.BowlingWizards/com.unity3d.player.UnityPlayerActivity}: java.lang.ClassNotFoundException: com.unity3d.player.UnityPlayerActivity in loader dalvik.system.PathClassLoader[/mnt/asec/com.nextwave.BowlingWizards-1/pkg.apk]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2590)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2684)
at android.app.ActivityThread.access$2300(ActivityThread.java:126)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2038)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4632)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:861)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:619)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: com.unity3d.player.UnityPlayerActivity in loader dalvik.system.PathClassLoader[/mnt/asec/com.nextwave.BowlingWizards-1/pkg.apk]
at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2582)”
I was getting this same exception on game launch after trying to follow the instructions on page listed above. I followed the advice above and placed the java (and class file after compiling with javac) into directories com/company/product but the exception kept being thrown. It appears that the package name needs to match your Bundle Identifier in your Project Settings → Player window. I’m not sure if the Bundle Identifier in the player window needs to match the package name in your custom AndroidManifest file as well (likely it does), but certainly the package value there didn’t seem to control what package the Android OS was looking in at run time.