GoogleVR - Crash opening application on device.

After compiling in UE4.21 application crash on startup.In UE4.20 everything worked.What could be the reason?
Device: Xiaomi Mi5s Plus (Android 7.0)
Error log:
java.lang.NoSuchFieldError: No field ui_settings_button_holder of type I in class Lcom/google/vr/cardboard/R$id; or its superclasses (declaration of ‘com.google.vr.cardboard.R$id’ appears in /data/app/com.abc-1/base.apk)
at com.google.vr.cardboard.UiLayer.inflateViewsWithLayoutId(SourceFile:26)
at com.google.vr.cardboard.UiLayer.<init>(SourceFile:12)
at com.google.vr.ndk.base.GvrUiLayoutImpl.<init>(SourceFile:8)
at com.google.vr.ndk.base.GvrUiLayoutImpl.<init>(SourceFile:1)
at com.google.vr.ndk.base.GvrLayoutImpl.init(SourceFile:27)
at com.google.vr.ndk.base.GvrLayoutImpl.<init>(SourceFile:13)
at com.google.vr.ndk.base.GvrLayoutImpl.<init>(SourceFile:1)
at com.google.vr.ndk.base.GvrLayoutFactory.createFromCurrentPackage(SourceFile:10)
at com.google.vr.ndk.base.GvrLayoutFactory.create(SourceFile:6)
at com.google.vr.ndk.base.GvrLayout.init(SourceFile:23)
at com.google.vr.ndk.base.GvrLayout.<init>(SourceFile:5)
at com.epicgames.ue4.GameActivity.onCreate(GameActivity.java:2785)
at android.app.Activity.performCreate(Activity.java:6856)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2699)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2807)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1540)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:163)
at android.app.ActivityThread.main(ActivityThread.java:6359)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770)

Hey,have you found a solution? It happend too when I open my GoogleVR project on Pixel.

We are also experiencing this problem. There seems to be a bug report here documenting the exact same issue: Unreal Engine Issues and Bug Tracker (UE-65983)

Unfortunately, it has been marked as “Cannot Reproduce” but I hope someone at Epic takes another look because it is clearly still an issue in 4.21 for several people.

I have spent several days already trying to fix this but my only solution is to use 4.19 at the moment. When you disable the Google VR plugin it launches successfully.

I have tried the following devices (All Android 8.0):
Samsung S7
Samsung A5 (2017)
LG G6

Strangely enough it seems to work when running on a Google Pixel 2 (Android 9.0).

We have tried:

  • Different SDK and NDK configurations (we currently try to target android-26)
  • Updated engine to 4.21.2
  • Two different Windows 10 based development machines
  • Fresh install of Unreal Engine and Android Development (as per UE documentation) on our Mac mini (OSX 10.14)

None of this has worked for us. My logcat is always the same result (exactly what AlloteSoftware posted).

I’m having this problem, too. But on some samrtphone the game runs and works great… for example, sometimes it helps to install “google vr services” and “cardboard” on your smartphone. Thus, this error was corrected on the smartphone Le 2 (le_s2). But on other models it didn’t help.
The problem I first encountered when I started trying to download a finished game on google play. I was developing a game in UE4.19 and api23 everything worked fine, but downloading apps from google play requires api not below 26. I tried selecting target api 26 or 27, but the game only showed a black screen at startup. When I shut off the VR plug-in, everything started to work. It seems that VR plugin in UE4.19 cannot work with api 26 and above. To fix this, I updated UE4 to 4.19.2 but got the “java.lang.NoSuchFieldError…” on a large count of samrtphones.


automatic test shows here are the results-on some models the game somehow works. Probably why Epic could not repeat it and marked the error as " Cannot Reproduce". At this point I keep looking for any options to fix this error…

My application in the version ue 4.22 (preview) does not work yet.

My personal theory is that the Google VR plugin used in UE4.21 and later only works with Daydream compatible phones. It works for me in UE4.20 on a GalaxyJ7 and an old Nexus7, the report mentioned earlier, Unreal Engine Issues and Bug Tracker (UE-65983), has been updated saying, “This issue was encountered during the XR compat pass and crash did not occur on 13832_Galaxy_S9_Mali.”, a Daydream compatible phone.

I think you’re right I asked my friends to check if their smartphone supports daydream. It turned out that daydream is not supported on all problematic devices… and the game does not work, although in such cases, it should work with cardboard.

the game not work and daydream not supported:

Asus ZenFone Max Pro
Galaxy S7 edge (hero2lte)

the game work (in cardboard) and daydream supported:

Xiaomi redmi note 3 pro (custom android 8.1)
Le 2 (le_s2) (custom android 8.1)

My friend was able to run the game (Galaxy S7 edge) when he installed the module to enable daydream support. The game started, but did not work correctly… The description of this module says that it adds 2 lines to build.prop file. One of these lines indicates support for high performance mode…Perhaps if you disable this mode in project settings, it will be a temporary solution to the problem… I’ll check it out and write here if it works…

So I wanted to provide an update on what I was able to finally get working and publish a Google Cardboard VR app to the Play Store. It ended up working on all devices tested (so far). Just wanted to share what I ended up doing in hopes it helps someone. Please note this was ONLY for a Cardboard VR app and NOT a Daydream app, so there might still be some issues related to that I am unaware of.

  1. Download the Google VR branch of the Unreal Engine here: https://github.com/googlevr-unreal/UnrealEngine (for instructions on how to access this please refer to the Unreal Documentation here: Unreal Engine on GitHub ). I used the Google 4.20 branch of the Unreal Engine.

  2. Follow the build instructions on the Github page under the section “Getting up and running”

  3. **Important **As per a bug reported here: https://github.com/googlevr-unreal/UnrealEngine/issues/38 you will need to manually go into the source code and comment out a couple lines of code. Without doing this you will most likely still experience crashes using the back / close button on certain devices.

  1. Setup your project using the proper Google VR / Android configuration settings located under the Google VR Quickstart Guide: https://docs.unrealengine.com/en-us/Platforms/GoogleVR/QuickStart

Note: For my specific project I was using:



Android NDK: android-ndk-r15c
SDK API Level: android-26
NDK API Level: latest


That should be it! Good luck!

this fix works, but only with version 4.20. I have a project in version 4.21 - I tried to download the source code of the engine 4.21.2 from github(https://github.com/EpicGames/UnrealEngine/releases) and apply this fix - it doesn’t work, game crashes on startup. Maybe you know how to apply this fix correctly to a new version of the engine?

i found how to apply this fix to the engine version 4.21

I used the solution that was offered here (https://github.com/googlevr-unreal/UnrealEngine/issues/38). This worked, but only on version of 4.20 (I found the “if” block at line 160 - not at 198). But I need the engine version not lower 4.21. On version 4.21, I could not apply this fix… today I decided to try to replace googleVR folder with the engine version 4.21 folder from the old version 4.20, which I managed to fix it. And so I got 4.21 version of the engine with a working plugin from version 4.20! I did not have to rebuild the engine - I just immediately compiled the game and it worked! Maybe this fix work with version 4.22 as well…

Steps:

  1. download 4.20.2 branch googleVR from here (https://github.com/googlevr-unreal/UnrealEngine/releases)
  2. comment out a few lines as indicated here (https://github.com/googlevr-unreal/UnrealEngine/issues/38)
  3. build the engine
  4. download 4.21 Unreal Engine source code
  5. apply step “2” to 4.21 engine
  6. build the engine
  7. replace GoogleVR folder of ue 4.21 by GoogleVR folder from ue 4.20 (Engine\Source\ThirdParty)
  8. run 4.21 engine and compile the game

(sorry, i bad speak english - I’m still learning this language)

Glad to hear you were able to get it working with 4.21.

Thanks for posting the detailed instructions on your solution as well. I am sure it will help someone out there having the same issue.

I really wish these Google VR issues were fixed in the engine without having to do these tedious workarounds. :frowning:

Thanks to all you awesome previous posters, I was able to get it working with 4.22. However I replaced the GoogleVR folder just before step 6 instead of at step 7. I consequently got a build error that I was missing “libgvr.lib.”

To resolve it I effectively did my own version of step 7:

Replace everything in the following folders with the UE 4.20 GoogleVR folder equivalents:

Engine\Source\ThirdParty\GoogleVR\Lib\common_library
Engine\Source\ThirdParty\GoogleVR\Lib ransition_library

Not gonna lie; I can’t explain WHY it works so take those steps with a grain of salt.

Thanks sanchezzzz1997, this solution solve my apk the crash.
I did as you said, I installed
Google VR Services: https://play.google.com/store/apps/details?id=com.google.vr.vrcore
Cardboard: https://play.google.com/store/apps/details?id=com.google.samples.apps.cardboarddemo

And I copied the .apk and .obb to sdcard, and after I installed my game apk,
I checked if the obb file was in \Internal shared storage\Android\obb\com.YourCompany.[Project]
if the file is not there, you has to copy the obb to folder of your application.
I don’t know why, but in my case the folder com.YourCompany.[Project] does not appear in computer via usb file transfer,
but it appear on File Manager of my phone. The process to copy is the same.

Hey, these links are broken. Is there currentl any way to fix this problem?

I’m having thisproblem with a a 4.22.3 project and I can’t fix it.

Any ideas?

Thanks, this worked for me on 4.23 Preview building for Cardboard, Not Daydream, phone. The only change is step 5 isn’t needed. At the moment Epic currently has that code disabled.

Thanks for the help.

I found a solution as well, for me it simply worked to use the engine installed though the epic launcher:

  • I have installed 4.20 and 4.22
  • Then I copied the GoogleVR-Folder from EngineLoc4.20/Engine/Source/ThirdParty/
  • Remove the Folder GoogleVR from EngineLoc4.22/Engine/Source/ThirdParty/
  • Past the Folder where before removed

I can´t belive but the build was successful abd works on my non-daydream-supporting device

Cheers

I followed your steps for 4.23 Preview 7 and it worked! This is much more convenient than compiling the engine, thanks.

1 Like

I can confirm that this may be device-specific.
I had this problem on Sony XZ2 Compact and tried to solve it for 2 hours. Then I ran it on Google Pixel 1 and it worked immediately.

Personal conclusion: use Google VR on Daydream devices. The XZ2 is not a Daydream device. Though I’ve tried some VR games on the XZ2 and they do work… With Google VR UI (the settings icon on top right). Oh well…

P.S. I am using 4.24 and haven’t tried downgrading or copying folders etc.

Hello, I’m having the same prob. and i’m trying target sdk at 28, but it keep giving me black screen on some devices especially devices with android 9, but work fine on any other device.
and when i set my target sdk to 23 it work fine on all devices even the android 9’s.
I need to be on taget sdk 28 bcs google store doesn’t accept lower sdk.

Does anyone have a solution or a hints,
Thank you

Unreal Engine is a failure when it comes to development of VR apps on Android. It advertises it’s latest greatest final release of 4.25.3 but it cannot even package a simple Android game - that after downloading 12 GB of data, taking up 60 GB+ of space and compiling 2000+ shaders.

While a simple Android GoogleVR SDK Cardboard project (GitHub - googlevr/cardboard: Open source Cardboard SDK and samples) works easily building using Android Studio. I do not understand what kind of greed the CEO of Epic Games has after taking billions from China and other investors while not being able to fix a simple issue of bad coding mentioning “ui_settings_button_holder”.

I have tried various versions of this engine, multiple times - there is a serious lack of documentation as well. I do not want to go through this mental abuse, when I can just use GLSL and target the 2.3 billion Android devices with my app idea. So thanks, but no thanks for an engine that does not work. No wonder it is free - because it does not work!