Search Issue Tracker

Fixed in 2018.2.X

Fixed in 2017.1.X, 2017.2.X, 2017.3.X, 2018.1.X

Won't Fix in 5.6.X

Votes

6

Found in

2017.1.0p5

Issue ID

946104

Regression

Yes

[Android] Exception while initializing GoogleVR from Unity library using Gradle build system (Release build)

Mobile

-

Steps to reproduce:

1) Open Unity and create a new project
2) Switch platform to Android in the Build settings
3) In the Player Settings, enable Virtual Reality Supported and add Cardboard SDK in to the list
4) Create a new Keystore
5) In the Build Settings, change Build system in to the Gradle(New)
6) Build and Run project on a device

Expected result: GoogleVR should be initialized without an exception.

Actual result: Exception while initializing GoogleVR from Unity library using non Development build :

Google VR Error []: Exception initializing GoogleVR from Unity library. Didn't find class "com.unity3d.unitygvr.GoogleVR" on path: DexPathList[[zip file "/data/app/com.Company.GradleFailVr-2/base.apk"],nativeLibraryDirectories=[/data/app/com.Company.GradleFailVr-2/lib/arm, /data/app/com.Company.GradleFailVr-2/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
09-06 10:16:56.519 31242 31242 E Unity : Unable to initialize Google VR subsystem.
09-06 10:16:56.531 31242 31242 E Unity : Google VR Error []: Exception initializing GoogleVR from Unity library. Didn't find class "com.unity3d.unitygvr.GoogleVR" on path: DexPathList[[zip file "/data/app/com.Company.GradleFailVr-2/base.apk"],nativeLibraryDirectories=[/data/app/com.Company.GradleFailVr-2/lib/arm, /data/app/com.Company.GradleFailVr-2/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
09-06 10:16:56.531 31242 31242 E Unity : Unable to initialize Google VR subsystem.

Reproduced with:
2017.1.0a3, 2017.1.0f1, 2017.1.1f1, 2017.2.0b10, 2017.3.0a7

Not reproduced with:
5.6.3p2. 2017.1.0a1

Regression since:
2017.1.0a2 or 2017.1.0a3 (application crash using Gradle build system in 2017.1.0a2 version of Unity)

Devices under testing:
Samsung SM G925F (Galaxy S6 Edge)*, OS:7.0, CPU:arm64-v8a, GPU:Mali-T760, Build:samsung/zeroltexx/zerolte:7.0/NRD90M/G925FXXU5EQFC:user/release-keys

Lge LG D855 (G3)*, OS:5.0, CPU:armeabi-v7a, GPU:Adreno (TM) 330, Build:lge/g3_global_com/g3:5.0/LRX21R.A1445306351/1445306351:user/release-keys

Note: Works as expected when Development build is enabled in the Build Settings
---------------------------------------------------------------------
Fixed in : 2017.1.3p2, 2017.2.1p4, 2017.3.1p1 , 2018.1.0b7, 2018.2.0a1

Comments (3)

  1. tmendez

    Aug 06, 2019 21:41

    I was able to get around this by updating my Google VR Android package from the package manager, and also updating from the .unitypackage from the Google Vr Unity SDK https://github.com/googlevr/gvr-unity-sdk

  2. vuplex

    Nov 01, 2017 01:47

    I also ran into this issue while configuring Proguard minification for my project in Unity 2017.2. I had added a my own Proguard rules to proguard-user.txt as specified by the docs (https://docs.unity3d.com/Manual/android-gradle-overview.html), and I resolved the missing class issue you described by adding the Unity and GVR rules to my proguard-user.txt:

    ## Unity Proguard

    -keep class bitter.jnibridge.* { *; }
    -keep class com.unity3d.** { *; }
    -keep class org.fmod.* { *; }

    ## Google GVR SDK Proguard

    # Don't obfuscate any NDK/SDK code. This makes the debugging of stack traces in
    # in release builds easier.
    -keepnames class com.google.vr.ndk.** { *; }
    -keepnames class com.google.vr.sdk.** { *; }

    # These are part of the Java <-> native interfaces for GVR.
    -keepclasseswithmembernames,includedescriptorclasses class com.google.vr.** {
    native <methods>;
    }

    -keep class com.google.vr.cardboard.UsedByNative
    -keep @com.google.vr.cardboard.UsedByNative class *
    -keepclassmembers class * {
    @com.google.vr.cardboard.UsedByNative *;
    }

    -keep class com.google.vr.cardboard.annotations.UsedByNative
    -keep @com.google.vr.cardboard.annotations.UsedByNative class *
    -keepclassmembers class * {
    @com.google.vr.cardboard.annotations.UsedByNative *;
    }

    -keep class com.google.vr.cardboard.annotations.UsedByReflection
    -keep @com.google.vr.cardboard.annotations.UsedByReflection class *
    -keepclassmembers class * {
    @com.google.vr.cardboard.annotations.UsedByReflection *;
    }

  3. rrrus

    Oct 27, 2017 20:12

    Until Unity rolls out a proper fix for this, you can work around it by changing the Player Settings > Publishing Settings > Minify setting for Release to "None".

    The crash is coming from Proguard obfuscating GVR class names so they are no longer accessible externally.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.