Build for VR for Android crashes immediately, log shows NullPointerException

I’m trying to build my project for VR and install on Android. I’m able to build the .apk, get it to the Android device and install, I’m using Genymotion on my Desktop machine with an image of Android 4.4.4 - Moto X. I’ve updated Unity Personl to the latest patch 3/6: version 5.3.3.p3. But when running, it crashes pretty much immediately. I got the logs which have many lines for the attempted launch. There is one error message that looks like could be problem:

03-2022:13:24.393 I/DEBUG ( 126): memory map around fault addr 7dbf86b3:
03-20 22:13:24.393 I/DEBUG ( 126): 00008000-00108000 rw-
03-20 22:13:24.393 I/DEBUG ( 126): (no map for address)
03-20 22:13:24.393 I/DEBUG ( 126): 927a8000-92888000 rw- [anon:libc_malloc]
03-20 22:13:24.593 I/Choreographer( 3700): Skipped 102 frames! The application may be doing too much work on its main thread.
03-20 22:13:24.613 W/ActivityManager( 522): Force finishing activity com.crappo.postpatch/com.unity3d.player.UnityPlayerActivity
03-20 22:13:24.629 D/ ( 522): HostConnection::get() New Host Connection established 0xb872cad8, tid 3728
03-20 22:13:24.733 W/InputDispatcher( 522): channel ‘5295b2f4 com.crappo.postpatch/com.unity3d.player.UnityPlayerActivity (server)’ ~ Consumer closed input channel or an error occurred. events=0x9
03-20 22:13:24.733 E/InputDispatcher( 522): channel ‘5295b2f4 com.crappo.postpatch/com.unity3d.player.UnityPlayerActivity (server)’ ~ Channel is unrecoverably broken and will be disposed!
03-20 22:13:24.737 D/Zygote ( 186): Process 3700 terminated by signal (11)
03-20 22:13:24.877 W/InputDispatcher( 522): Attempted to unregister already unregistered input channel ‘5295b2f4 com.crappo.postpatch/com.unity3d.player.UnityPlayerActivity (server)’
03-20 22:13:24.877 I/WindowState( 522): WIN DEATH: Window{5295b2f4 u0 com.crappo.postpatch/com.unity3d.player.UnityPlayerActivity}
03-20 22:13:24.877 I/WindowState( 522): WIN DEATH: Window{52979ccc u0 SurfaceView}
03-20 22:13:24.885 W/ActivityManager( 522): Exception thrown during pause
03-20 22:13:24.885 W/ActivityManager( 522): android.os.DeadObjectException
03-20 22:13:24.885 W/ActivityManager( 522): at android.os.BinderProxy.transact(Native Method)
03-20 22:13:24.885 W/ActivityManager( 522): at android.app.ApplicationThreadProxy.schedulePauseActivity(ApplicationThreadNative.java:660)
03-20 22:13:24.885 W/ActivityManager( 522): at com.android.server.am.ActivityStack.startPausingLocked(ActivityStack.java:761)
03-20 22:13:24.885 W/ActivityManager( 522): at com.android.server.am.ActivityStack.finishActivityLocked(ActivityStack.java:2443)
03-20 22:13:24.885 W/ActivityManager( 522): at com.android.server.am.ActivityStack.finishTopRunningActivityLocked(ActivityStack.java:2320)
03-20 22:13:24.885 W/ActivityManager( 522): at com.android.server.am.ActivityStackSupervisor.finishTopRunningActivityLocked(ActivityStackSupervisor.java:2050)
03-20 22:13:24.885 W/ActivityManager( 522): at com.android.server.am.ActivityManagerService.handleAppCrashLocked(ActivityManagerService.java:9548)
03-20 22:13:24.885 W/ActivityManager( 522): at com.android.server.am.ActivityManagerService.makeAppCrashingLocked(ActivityManagerService.java:9441)
03-20 22:13:24.885 W/ActivityManager( 522): at com.android.server.am.ActivityManagerService.crashApplication(ActivityManagerService.java:10086)
03-20 22:13:24.885 W/ActivityManager( 522): at com.android.server.am.ActivityManagerService.handleApplicationCrashInner(ActivityManagerService.java:9637)
03-20 22:13:24.885 W/ActivityManager( 522): at com.android.server.am.NativeCrashListener$NativeCrashReporter.run(NativeCrashListener.java:86)
03-20 22:13:24.905 E/gralloc_vbox86( 185): gralloc_alloc: Mismatched usage flags: 720 x 1280, usage b33

Followed by this message at the end of the log:


03-20 19:59:38.565 W/genymotion_audio( 187): out_write() limiting sleep time 46802 to 39909
03-20 19:59:38.581 W/Binder ( 717): Caught a RuntimeException from the binder stub implementation.
03-20 19:59:38.581 W/Binder ( 717): java.lang.NullPointerException
03-20 19:59:38.581 W/Binder ( 717): at android.inputmethodservice.IInputMethodWrapper.setSessionEnabled(IInputMethodWrapper.java:280)
03-20 19:59:38.581 W/Binder ( 717): at com.android.internal.view.IInputMethod$Stub.onTransact(IInputMethod.java:129)
03-20 19:59:38.581 W/Binder ( 717): at android.os.Binder.execTransact(Binder.java:404)
03-20 19:59:38.581 W/Binder ( 717): at dalvik.system.NativeStart.run(Native Method)
03-20 19:59:38.581 W/InputMethodManagerService( 522): Got RemoteException sending setActive(false) notification to pid 2129 uid 10060

On my real Moto X, it gets to the message saying to swipe down to exit the app, then crashes. I’ll stick with getting it to work on the Genymotion first, because it’s easier to get the logs.

If I untick “VR supported”, the app is able to run and display on the device.

Player Settings:

  • minimum API 4.2
  • GPU skinning turned off
  • Device Filter: FAT (ARM7+x86)
    Any more settings needed to help?

Thanks !!

Hi @dsrgdeg, I didn’t solve it fully but got a little farther. The above error on this thread was when I was using the Oculus VR sample assets that came with the Unity download. With a little searching, I found that Google has a plugin for their VR view and it works a little better on the Moto X / Android 4.4.4. Here is the link:

I wanted to use the Unity built-in stuff because it appeared so easy to simply check the box. However, I found that it requires the Oculus plugin. Which requires and Oculus signature file. Which requires a supported device. And the only supported devices are Samsung Galaxy S4 or S5 to S7. Then it goes into a Gear VR which is $100 and has some serious deal breakers according to comments on Amazon (fixed inter pupillary distance, 10 minutes til phone overheats, and more). I toggled a setting so the game would play on the phone, but even on the supported S7 with an oculus signature file, I couldn’t figure out how to get it to play or work.

The Google VR for Unity was another download, some extraction, and some effort to add their components and read through the online documentation to get it to work. But it is the path I’m taking because it is the most likely path to work. And the Google stuff has more source I can read through to solve problems on my own, and is simpler to simply work instead of requiring many things like a signature file. I think GoogleVR works with an emulator, I forgot if I tried it. But the built-in Oculus version definitely does not work with an emulator – because you can’t get a device ID to get an Oculus signature file.

However – with the Google VR for Unity, it still does not work on the Moto X. Here is my next thread, where it gets farther but the error is that it can’t find libaudioplugingvrunity and OVRPlugin:

http://answers.unity3d.com/questions/1190702/googlevr-on-unity-has-error-cant-load-libaudioplug.html

The good news, the Google VR sample mostly worked on my Samsung S7. There was a buy-one-get-one free deal with my carrier, so I got one intending to go with the Gear VR until I read the Amazon reviews. Now I am using Unity with Google VR components, build into apk, and install on the Samsung S7, and 2 of 3 super-simple apps worked, only 1 crashed on start up.

I will continue to try to get it to work on my older Moto X, because I’d prefer to use that for games.

Another helpful tip – it’s good to get an app for identifying all the hardware components and drivers on your device because the Build settings have options like which version of OpenGl to use, or what type of chip to build for. I didn’t know what those meant until I got the device identifier, now I can at least match the options with what’s on my device.

Good luck, and please add any info or tips you find, if we all add some info I’m sure eventually we’ll be able to solve these problems and get our games to work on our preferred devices.

Hi all!

I’ve been searching for a solution for this problem for a loooooong time. My problem: Build app, run app black screen, crash. I did’nt even see the Unity splash screen. Turns out:
Before making an VR APK game, i was working with the Oculus version. Working with Oculus you have to select the ‘Virtual Reality Supported’ option in the Player Settings.

For Android/Ios this has to be turned OFF. Then at the presentation settings (top tab) only select the ‘Landscape’ options. Dont use the ‘Portrait’ options.

Hope this helps…