Solved: Samsung GearVR application closed unexpectedly

By February 3, 2017Trial By Error

As we were preparing to submit our final build of Acorn Assault VR: The Ride to the Oculus store, we encountered a critical app crash during the app launch process via Oculus Home. The message displayed upon selecting our title from the menu read “Acorn Assault VR: The Ride has closed unexpectedly”, which is not a very useful error message. Instead of trial and error, it was time to configure logcat over TCPIP. This is a much-needed step because you can’t debug your VR title via USB debugging since the port is being used by the VR headset. Here are the step by step instructions on getting adb over tcpip setup:

1. Make sure you have your Environment Variables Path entry pointing to the android-sdk\platform-tools folder.

2.  Open a command window and type adb usb while your device is plugged in. (Note: Make sure USB Debugging is turned on prior to this step.)

3. Now type adb tcpip 5555, which will restart adb in TCP mode on port 5555. This port can be changed depending on your firewall rules.

4. Get the IP address of your phone by going to setting -> about on the device and type in adb connect XXX.XXX.XX.XX:5555.

5. Unplug the phone and type adb logcat > “c:\[some folder]\[some file name]” This will dump a log of system messages and stack traces to the output file. To reduce the amount of noise in this file when debugging I would recommend running this command just prior to launching your title.

6. Run your application and inspect the log file after the crash. We filtered out our log file by simply searching for our bundle identifier.

 

The culprit in our case was a poorly formatted AndroidManifest.xml file. We were able to tell this because of the following class not found exception being thrown at launch:

02-01 19:03:17.551 13823 13823 E AndroidRuntime: Process: com.hightalestudios.aavrride, PID: 13823 02-01 19:03:17.551 13823 13823 E AndroidRuntime: java.lang.RuntimeException: Unable to instantiate application com.samsung.android.vr.application.mode: java.lang.ClassNotFoundException: Didn’t find class “com.samsung.android.vr.application.mode”.

 

We removed the unnecessary tag and we were ready to go!