Unity android app crashes at start with java null object reference error

1.2k views Asked by At

I have a Unity project for an android app using the Google Tango sdk and GVR sdk that worked fine on Unity 2017.2. I had to port it back on Unity 5 and now the app crashes at start on the phone and I have no idea where it comes from, I am not familiar with android and java.

I ported the project from Unity 2017 to Unity 5 by opening it with Unity 5 and letting it downgrade the project.

Here are the phone logs I get when I start the app:

02-16 12:41:35.181 1392-4698/? I/ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000  cmp=com.GFI.TangoMapping9/com.google.unity.GoogleUnityActivity} from uid 2000 on display 0
02-16 12:41:35.197 1392-4698/? I/ActivityManager: Start proc 15084:com.GFI.TangoMapping9/u0a165 for activity com.GFI.TangoMapping9/ com.google.unity.GoogleUnityActivity
02-16 12:41:35.239 15084-15084/? E/AndroidRuntime: 
   FATAL EXCEPTION: main
   Process: com.GFI.TangoMapping9, PID: 15084
   java.lang.Error: FATAL EXCEPTION [main]
   Unity version     : 5.6.5f1
   Device model      : LENOVO Lenovo PB2-690M
   Device fingerprint: Lenovo/phinny_row/PB2PRO:6.0.1/MMB29M/PB2-690M_S200100_170228:user/release-keys

   Caused by: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.GFI.TangoMapping9/com.google.unity.GoogleUnityActivity}:   java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.os.Bundle.getBoolean(java.lang.String, boolean)' on a null object reference
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2417)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2477)
       at android.app.ActivityThread.access$900(ActivityThread.java:150)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:148)
       at android.app.ActivityThread.main(ActivityThread.java:5418)
       at java.lang.reflect.Method.invoke(Native Method)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
    Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.os.Bundle.getBoolean(java.lang.String, boolean)' on a null object reference
       at com.google.unity.GoogleUnityActivity.onCreate(GoogleUnityActivity.java:107)
       at android.app.Activity.performCreate(Activity.java:6285)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2370)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2477) 
       at android.app.ActivityThread.access$900(ActivityThread.java:150) 
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
       at android.os.Handler.dispatchMessage(Handler.java:102) 
       at android.os.Looper.loop(Looper.java:148) 
       at android.app.ActivityThread.main(ActivityThread.java:5418) 
       at java.lang.reflect.Method.invoke(Native Method) 
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
02-16 12:41:35.241 1392-4608/? W/ActivityManager:   Force finishing activity com.GFI.TangoMapping9/com.google.unity.GoogleUnityActivity

I know that a lot of similar questions have been posted and I read that for this kind of issue, the problem was often in the MainActivity but in a Unity project I am not supposed to edit it, and woundn't even know where to find it in the apk. Any idea where it comes from?


Edit

I found a turnaround to get my project to work again on Unity 5. I created a new Unity 5 project, copied/pasted the asset folder from my Unity 2017 project to this new project and reimported the GVR sdk package in this project.

0

There are 0 answers