Gvr-unity-sdk: GoogleUnityActivity not found

Created on 26 May 2016  Â·  7Comments  Â·  Source: googlevr/gvr-unity-sdk

When exporting a project to Android Studio (you can check with the example project), Android Studio can't find GoogleUnityActivity in the manifest, changing it to UnityPlayerActivity tries to start the app but it closes immediately.

Most helpful comment

Try this (I'm saying all my steps just in case):

  • In Unity, export the project to Android Studio
  • In Android Studio, import the project, make sure it is gradle-based
  • File -> New Module -> Import Jar/Aar, and select Assets/Plugins/gvr_android_common.aar
  • Repeat the above step for unityvractivity.aar
  • Open the Module Settings for the app, select the Dependencies tab
  • Add a Module dependency for each of the two .aar's

All 7 comments

The correct manifest (or at least the one you should start with before editing) is in Assets/Plugins/Android. It appears that Unity uses it when building from the editor but not when exporting to AS. We'll have to add that to the online SDK docs.

I've tried, but that manifest uses GoogleUnityActivity too so there's been no more luck. Changing it to UnityPlayerActivity gives this error:

xception getting class com.google.vr.platform.unity.UnityVrActivityListener: UnityEngine.AndroidJavaException: java.lang.ClassNotFoundException: com.google.vr.platform.unity.UnityVrActivityListener
java.lang.ClassNotFoundException: com.google.vr.platform.unity.UnityVrActivityListener

I still have a copy of the old SDK and that one still works properly.

The manifest is supposed to use GoogleUnityActivity. The C# code expects it. It appears that the Android Studio project doesn't link to the .aar's that are in our SDK. GoogleUnityActivity is in unityvractivity.aar.

Try this (I'm saying all my steps just in case):

  • In Unity, export the project to Android Studio
  • In Android Studio, import the project, make sure it is gradle-based
  • File -> New Module -> Import Jar/Aar, and select Assets/Plugins/gvr_android_common.aar
  • Repeat the above step for unityvractivity.aar
  • Open the Module Settings for the app, select the Dependencies tab
  • Add a Module dependency for each of the two .aar's

Now it works! Thank you so much for your help :)

hello smdol, where can I know how to use GoogleUnityActivity ? just a normal activity inherit this one?

Hi @smdol, what sdk version was this with? I've recently faced this issue and I'm using v1.20.0

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pandailing picture pandailing  Â·  4Comments

nanweiqing picture nanweiqing  Â·  5Comments

SelaO picture SelaO  Â·  4Comments

fredsa picture fredsa  Â·  5Comments

vinhui picture vinhui  Â·  6Comments