2016-10-14 62 views
2

我正在一個Unity應用程序。當它處於前臺並且用戶從通知欄中點擊通知視圖並且正在觸發掛起的意圖時,它會崩潰。應用程序崩潰,logcat中沒有明確的堆棧跟蹤可用。在前景中的Unity應用程序崩潰,並點擊從相同的應用程序創建的通知

什麼程序崩潰的過程中,我可以看到的是如下

I/WindowState: WIN DEATH: Window{26cb4ca u0 com.aman.unitytest/com.unity3d.player.UnityPlayerProxyActivity} 
10-14 16:28:57.234 1796-2360/? 

下面是logcat的一塊,當用戶點擊通知:

10-14 16:28:56.359 3669-3669/? W/Timer-46: type=1400 audit(0.0:1190715): avc: denied { getattr } for uid=10230 path="/proc/194" dev="proc" ino=8077 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0 
10-14 16:28:56.402 2404-2404/? D/StatusBar: Clicked on content of 0|com.aman.unitytest|10343|null|10231 
10-14 16:28:56.410 1796-7655/? W/NotificationService: No notification with key: 0|com.aman.unitytest|10343|null|10231 
--------- beginning of system 
10-14 16:28:56.419 1796-1806/? I/ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=com.aman.unitytest cmp=com.aman.unitytest/com.unity3d.player.UnityPlayerProxyActivity} from uid 10231 on display 0 
10-14 16:28:56.435 2404-2404/? V/PhoneStatusBar: setLightsOn(true) 
10-14 16:28:56.448 1796-10063/? W/InputMethodManagerService: Window already focused, ignoring focus gain of: [email protected] attribute=null, token = [email protected] 
10-14 16:28:56.458 356-356/? I/SFPerfTracer:  triggers: (rate: 13:886) (compose: 0:2) (post: 0:1) (render: 1:49) (480:43276 frames) (481:45950) 
10-14 16:28:56.459 356-356/? D/SFPerfTracer:  layers: (3:10) (FocusedStackFrame (0xb82131a0): 0:384)* (DimLayer (0xb8214f88): 0:23)* (StatusBar (0xb825eee8): 57:4149) (NavigationBar (0xb82b3180): 16:1944) (com.android.systemui.ImageWallpaper (0xb82a7ea0): 1:241)* (DimLayer (0xb82d3d08): 0:392)* (DimLayer (0xb8264580): 0:40)* (com.aman.unitytest/com.unity3d.player.UnityPlayerActivity (0xb8287078): 0:8)* (SurfaceView (0xb8288340): 479:4873) 
10-14 16:28:56.719 382-968/? W/APM::EffectDescriptor: unregisterEffect() unknown effect ID 354 
10-14 16:28:56.839 1796-3013/? D/bsthal: setDelay, handle: 1598182229 delay: 200000000 
10-14 16:28:56.839 1796-3013/? E/bsthal: <BST> set delay: 200000000ns 
10-14 16:28:56.839 1796-3013/? I/bsthal: <BST> set delay of <BOSCH BMC150 Acceleration Sensor> to 200ms 
10-14 16:28:56.861 1796-10063/? D/bsthal: activate, handle: 1598182242, enabled: 1, index 2 
10-14 16:28:56.861 1796-10063/? D/bsthal: BstSensorExt: id=1598182242, en=1 
10-14 16:28:56.861 1796-10063/? D/bsthal: enable ID_SORI, path /sys/class/srot_sensor/g_sensor/en_disp_rotation, fd 233 
10-14 16:28:56.861 1796-2337/? D/bsthal: readEvents,event.type is 4,event value is -1,event code is 3 
10-14 16:28:56.862 1796-2337/? D/bsthal: readEvents,event.type is 0,event value is 0,event code is 0 
10-14 16:28:56.864 1796-10063/? D/bsthal: setDelay, handle: 1598182242 delay: 66667000 
10-14 16:28:56.886 2404-2404/? V/PhoneStatusBar: setLightsOn(true) 
10-14 16:28:56.900 2404-2404/? D/PhoneStatusBar: disable: < expand icons* alerts system_info* back home recent clock search quick_settings > 
10-14 16:28:56.909 2404-2404/? V/QSTileView: setDual true 
10-14 16:28:56.909 2404-2404/? V/QSTileView: setDual false 
10-14 16:28:56.931 1796-1940/? I/LaunchCheckinHandler: Displayed com.aman.unitytest/com.unity3d.player.UnityPlayerProxyActivity,wp,wa,512 
10-14 16:28:57.203 25990-25990/? I/Process: Sending signal. PID: 25990 SIG: 9 
10-14 16:28:57.233 1796-7655/? I/WindowState: WIN DEATH: Window{26cb4ca u0 com.aman.unitytest/com.unity3d.player.UnityPlayerProxyActivity} 
10-14 16:28:57.234 1796-2360/? D/WifiService: Client connection lost with reason: 4 
10-14 16:28:57.238 1796-2833/? I/WindowState: WIN DEATH: Window{5747b17 u0 com.aman.unitytest/com.unity3d.player.UnityPlayerActivity} 
10-14 16:28:57.281 1796-3017/? I/ActivityManager: Process com.aman.unitytest (pid 25990) has died 
10-14 16:28:57.281 1796-3017/? W/ActivityManager: Scheduling restart of crashed service com.aman.unitytest/semusi.activitysdk.Api in 1000ms 
10-14 16:28:57.282 1796-3017/? W/ActivityManager: Force removing ActivityRecord{38d66f8 u0 com.aman.unitytest/com.unity3d.player.UnityPlayerProxyActivity t994}: app died, no saved state 
10-14 16:28:57.282 1796-3017/? I/ActivityManager: moveHomeStack, setupComplete:true 
10-14 16:28:57.287 1796-3017/? D/bsthal: activate, handle: 1598182242, enabled: 0, index 2 
10-14 16:28:57.287 1796-3017/? D/bsthal: BstSensorExt: id=1598182242, en=0 
10-14 16:28:57.287 1796-3017/? D/bsthal: enable ID_SORI, path /sys/class/srot_sensor/g_sensor/en_disp_rotation, fd 103 
10-14 16:28:57.313 25901-25938/? V/ConnectivityManager: isActiveNetworkMetered() returns:false 
+1

調試您的代碼並檢查崩潰背後的原因..我們無法僅通過檢查日誌來提供幫助。 – Gattsu

+0

H maven,Thnx供您考慮。但你可以幫助我如何調試統一應用程序來檢查是什麼原因導致上述問題。 –

回答

1

得到了問題,並使其可行。以下是現在用於pendingIntent通知的內容。

launchIntent.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_NEW_TASK); 

而在使用unity時,它們是AndroidManfiest.xml中提到的不推薦使用的Launcher,如下所示。停止使用它了。

com.unity3d.player.UnityPlayerProxyActivity 

請改用您的AndroidManifest中的以下條目以使其正確。

<activity 
      android:name="com.unity3d.player.UnityPlayerActivity" 
      android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" 
      android:label="@string/app_name" > 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 

由於ProxyActivity下面在其的onCreate()。因此,無論您在pendingIntent中添加的任何標誌都沒有關係。此代理活動將忽略所有內容。

paramBundle = new String[] { "com.unity3d.player.UnityPlayerActivity", "com.unity3d.player.UnityPlayerNativeActivity" }; 
    copyPlayerPrefs(this, paramBundle); 
    try 
    { 
     int i = Build.VERSION.SDK_INT >= 9 ? 1 : 0; 
     paramBundle = Class.forName(paramBundle[0]); 
     (paramBundle = new Intent(this, paramBundle)).addFlags(65536); 
     Bundle localBundle; 
     if ((localBundle = getIntent().getExtras()) != null) { 
     paramBundle.putExtras(localBundle); 
     } 
     startActivity(paramBundle); 
     return; 
    } 
    catch (ClassNotFoundException localClassNotFoundException) {}finally 
    { 
     finish(); 
    }