Search Unity

Upgrading Android app to latest Unity & Google VR now says "app has stopped"

Discussion in 'AR/VR (XR) Discussion' started by DoctorMobius, Jun 13, 2017.

  1. DoctorMobius

    DoctorMobius

    Joined:
    Oct 2, 2014
    Posts:
    15
    After upgrading an existing Android game to Unity 5.6.1p3 with Google VR SDK 1.60, I now get an immediate crash "Unfortunately, app has stopped" message. I opened Android Studio and looked in the logcat window:

    06-13 14:21:43.624 293-3659/? E/AudioPolicyManager: unknown stream type
    06-13 14:21:43.624 293-3659/? E/AudioPolicyManager: unknown stream type
    06-13 14:21:43.634 29546-29546/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.NealJonesGames.EarthAttack, PID: 29546
    java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.NealJonesGames.EarthAttack/com.google.unity.GoogleUnityActivity}: java.lang.ClassNotFoundException: Didn't find class "com.google.unity.GoogleUnityActivity" on path: DexPathList[[zip file "/data/app/com.NealJonesGames.EarthAttack-1/base.apk"],nativeLibraryDirectories=[/data/app/com.NealJonesGames.EarthAttack-1/lib/arm, /vendor/lib, /system/lib]]
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2322)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2474)
    at android.app.ActivityThread.access$800(ActivityThread.java:144)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1359)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:155)
    at android.app.ActivityThread.main(ActivityThread.java:5696)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1028)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
    Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.unity.GoogleUnityActivity" on path: DexPathList[[zip file "/data/app/com.NealJonesGames.EarthAttack-1/base.apk"],nativeLibraryDirectories=[/data/app/com.NealJonesGames.EarthAttack-1/lib/arm, /vendor/lib, /system/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
    at android.app.Instrumentation.newActivity(Instrumentation.java:1083)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2312)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2474)
    at android.app.ActivityThread.access$800(ActivityThread.java:144)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1359)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:155)
    at android.app.ActivityThread.main(ActivityThread.java:5696)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1028)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
    Suppressed: java.lang.ClassNotFoundException: com.google.unity.GoogleUnityActivity
    at java.lang.Class.classForName(Native Method)
    at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
    at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
    ... 13 more
    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
    06-13 14:21:43.634 649-1409/? E/ActivityManager: App crashed! Process: com.NealJonesGames.EarthAttack
    06-13 14:21:43.634 649-1409/? W/ActivityManager: Force finishing activity com.NealJonesGames.EarthAttack/com.google.unity.GoogleUnityActivity


    I've got the Google Cardboard app installed and I can see the link to the game in there okay, so I wonder what is missing? My settings are as follows:
    • 32 bit display buffer is off
    • Colour space is Gamma
    • Auto Graphics API enabled
    • Multithreaded rendering off
    • Virtual reality SDKs are set to Cardboard (16-bit depth)
    • Stereo rendering method is multi-pass
    • Minimum API level set to 4.4 Kit-Kat (API level 19)
    • Scripting backend is Mono2x
    • Device filter is FAT (ARMv7 and x86)
    • Stripping level disabled
    I've tried a variety of combinations of the settings above but nothing seems to make a difference.

    I am using the GoogleVR audio spatializer too, and there is something in the log about an "unknown stream type" but I have been using that spatializer previously without a problem.

    Does anyone have any suggestions for me? Thank you in advance!
     
  2. DoctorMobius

    DoctorMobius

    Joined:
    Oct 2, 2014
    Posts:
    15
    Fixed it courtesy of this post: http://baba-s.hatenablog.com/entry/2017/02/13/100000

    I had to edit the /plugins/android/AndroidManifest-Cardboard.xml to replace
    com.google.unity.GoogleUnityActivity
    with
    com.unity3d.player.UnityPlayerActivity

    I then copied saved a copy of that file as AndroidManifest.xml along side the other one as I needed to add the licence check permission.

    The game runs successfully now!
     
    amplifiedciaran likes this.
  3. amplifiedciaran

    amplifiedciaran

    Joined:
    Oct 24, 2016
    Posts:
    16
    This solution worked for me. Thanks
     
  4. jeffgennusa

    jeffgennusa

    Joined:
    Dec 17, 2017
    Posts:
    1
    How? How do you edit this? Did you edit it on your phone, or in Unity? i don't understand how to edit this? please help explain it.
     
  5. DoctorMobius

    DoctorMobius

    Joined:
    Oct 2, 2014
    Posts:
    15
    Whilst you're in Unity, look in the /Plugins/Android folder and you'll see the AndroidManifest-Cardboard.xml that I mentioned in my post.

    Edit the line as I explained - but I don't think you need to make a separate AndroidManifest.xml yourself unless you also need to add in further settings for both Cardboard and Daydream.

    Rebuild your project - best of luck!