Unity android应用程序在启动时崩溃,因为java null对象引用错误

时间:2018-02-16 15:00:52

标签: java android unity3d google-project-tango google-vr

我有一个使用Google Tango sdk和GVR sdk的Android应用程序的Unity项目,它在Unity 2017.2上运行良好。我不得不将它移回Unity 5,现在应用程序在手机启动时崩溃,我不知道它来自哪里,我不熟悉android和java。

我将Unity 2017中的项目从Unity 2017移植到Unity 5,然后让它降级项目。

以下是我启动应用时获得的手机日志:

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

我知道有很多类似的问题已经发布了,我读到这个问题,问题通常在MainActivity中,但在Unity项目中,我不应该编辑它,并且伤害了#n; tt甚至知道在哪里可以找到它。知道它来自何处?

修改

我找到了一个好转,让我的项目再次在Unity 5上运行。我创建了一个新的Unity 5项目,将我的Unity 2017项目中的资产文件夹复制/粘贴到这个新项目中,并在此项目中重新导入了GVR sdk包

0 个答案:

没有答案