Search Unity

Random Unable to resume activity: Window couldn't find content container view

Discussion in 'Android' started by YuriBazila, Jan 28, 2019.

  1. YuriBazila

    YuriBazila

    Joined:
    Feb 1, 2013
    Posts:
    47
    Unity 2018.3.3f1 (also happened in 2017.2.20, 2018.3.1)

    I've got FATAL EXCEPTIONs caused by "Unable to resume activity", when I open some new activities. Facebook sharing, untiy iap etc. It happends randomly, not every time.

    What is it? Can someone help me?

    I use common plugins, like UnityAds, Admob Ads, Unity IAP, Google play games services, PlayFab, Facebook sharing. I used these plugins in lots of projects, but only here it's happening.

    Code (JavaScript):
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="__PACKAGENAME__" xmlns:tools="http://schemas.android.com/tools" android:installLocation="auto">
    3.   <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
    4.   <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    5.   <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    6.   <uses-permission android:name="android.permission.INTERNET" />
    7.   <uses-permission android:name="android.permission.VIBRATE" />
    8.   <application android:theme="@style/UnityThemeSelector" android:label="@string/app_name" android:isGame="true" android:banner="@drawable/app_banner" android:icon="@mipmap/app_icon">
    9.     <activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name" android:screenOrientation="sensorLandscape" android:launchMode="singleTask" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection|density" android:hardwareAccelerated="false">
    10.       <intent-filter>
    11.         <action android:name="android.intent.action.MAIN" />
    12.         <category android:name="android.intent.category.LAUNCHER" />
    13.         <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
    14.       </intent-filter>
    15.       <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
    16.     </activity>
    17.  
    18.     <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="__ID__" />
    19.     <activity android:name="com.facebook.unity.FBUnityLoginActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
    20.     <activity android:name="com.facebook.unity.FBUnityDialogsActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
    21.     <activity android:name="com.facebook.unity.FBUnityAppLinkActivity" android:exported="true" />
    22.     <activity android:name="com.facebook.unity.FBUnityDeepLinkingActivity" android:exported="true" />
    23.     <activity android:name="com.facebook.unity.FBUnityGameRequestActivity" />
    24.     <activity android:name="com.facebook.unity.FBUnityCreateGameGroupActivity" />
    25.     <activity android:name="com.facebook.unity.FBUnityJoinGameGroupActivity" />
    26.     <activity android:name="com.facebook.unity.AppInviteDialogActivity" />
    27.     <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="__ID__" />
    28.     <meta-data android:name="com.facebook.sdk.AutoLogAppEventsEnabled" android:value="true" />
    29.     <provider android:name="com.facebook.FacebookContentProvider" android:authorities="com.facebook.app.FacebookContentProvider__ID__" android:exported="true" />
    30.     <meta-data android:name="unity.build-id" android:value="__ID__" />
    31.     <meta-data android:name="unity.splash-mode" android:value="2" />
    32.     <meta-data android:name="unity.splash-enable" android:value="True" />
    33.   </application>
    34.   <uses-feature android:glEsVersion="0x00020000" />
    35.   <uses-feature android:name="android.hardware.sensor.accelerometer" android:required="false" />
    36.   <uses-feature android:name="android.hardware.touchscreen" android:required="false" />
    37.   <uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="false" />
    38.   <uses-feature android:name="android.hardware.touchscreen.multitouch.distinct" android:required="false" />
    39. </manifest>

    Code (JavaScript):
    1. java.lang.RuntimeException: Unable to resume activity {com.MY.PACKAGENAME/com.facebook.unity.FBUnityDialogsActivity}: java.lang.RuntimeException: Window couldn't find content container view
     
  2. YuriBazila

    YuriBazila

    Joined:
    Feb 1, 2013
    Posts:
    47
    It's really hurt for us because it's happening when people try to buy something or share.
    Can someone help with an idea what is this? Looks like something with native android settings, like AndroidManifest or maybe I missed some libriries?
     
  3. TarekC

    TarekC

    Joined:
    Jun 26, 2018
    Posts:
    1
    Have you found the solution?
     
  4. u546342

    u546342

    Joined:
    Dec 26, 2016
    Posts:
    3
    I have the same problem on unity 2017.4.27f.
    Have you found the solution?
     
  5. unity_u-1b5w09hDYeow

    unity_u-1b5w09hDYeow

    Joined:
    Sep 12, 2018
    Posts:
    4
    Having same problem 2019.1.8f1
    Anyone found the solution yet?
     
  6. dicastyle

    dicastyle

    Joined:
    Jun 30, 2014
    Posts:
    8
    I have the same problem on unity 2018.4.11f.
    I can not find the solution..;(
    Anyone found it ?
     
  7. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    I am also wondering how to solve this. Some people were able to get it working bu jumping between different AndroidX versions.

    I can only confirm that this issue is unrelated to the Unity version.
    Still no luck with the straight forward way how to solve it or at least ideas what exactly is causing it.
     
  8. SergeyBocharov

    SergeyBocharov

    Joined:
    Jul 30, 2017
    Posts:
    3
    Having same problem 2019.2.11f1
    Anyone found the solution yet?

    12-13 10:43:04.286 29697-29697/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.ugo.play.free.farm.valley, PID: 29697
    java.lang.Error: FATAL EXCEPTION [main]
    Unity version : 2019.2.11f1
    Device model : samsung SM-G900F
    Device fingerprint: samsung/kltexx/klte:6.0.1/MMB29M/G900FXXS1CQD1:user/release-keys

    Caused by: java.lang.RuntimeException: Window couldn't find content container view
    at com.android.internal.policy.PhoneWindow.generateLayout(PhoneWindow.java:4614)
    at com.android.internal.policy.PhoneWindow.installDecor(PhoneWindow.java:4683)
    at com.android.internal.policy.PhoneWindow.getDecorView(PhoneWindow.java:2263)
    at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4271)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3360)
    at android.app.ActivityThread.access$1100(ActivityThread.java:221)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:158)
    at android.app.ActivityThread.main(ActivityThread.java:7224)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
     
  9. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Not me, but still looking for it.
    It also seems only related to Android 5 & 6
     
  10. Temka_193

    Temka_193

    Joined:
    Oct 24, 2015
    Posts:
    47
    I am also worried about this problem, if I delete FacebookSDK, then it disappears. I do not want to delete FacebookSDK, you need to understand what the problem is.
     
    stanislav-osipov likes this.
  11. phuongnh

    phuongnh

    Joined:
    Sep 23, 2019
    Posts:
    22
    We also experienced a lot a crashes exactly like this with Unity 2018.4.12f1, and it seems only related to Android 5 & 6. Still could not find a solution yet. Btw, do you know steps to re-produce this bug on devices?
     
  12. DevPitaya

    DevPitaya

    Joined:
    Feb 12, 2018
    Posts:
    5
    We're also experiencing the same issue here. This problem only started occurring after 12/24/2019 for us. Before this, we haven't run into this issue before. We haven't changed anything big regarding SDKs and plugins.. not sure why it just suddenly appeared overnight.
     
  13. phuongnh

    phuongnh

    Joined:
    Sep 23, 2019
    Posts:
    22
    For now, we have to disable Facebook on Android 5 & 6 to resolve this issue.
    We only called Facebook.Init() in our game (not any other facebook functions), and now we have to ignore that call if the device < Android 7.

    It seems that this issue happens randomly. I used to reproduce this issue on an Android 6 device (twice), and from the log I saw that it was related to Facebook SDK (the Facebook SDK could not init).
     
  14. DevPitaya

    DevPitaya

    Joined:
    Feb 12, 2018
    Posts:
    5
    Has there been a fix or workaround issued for this? Is there anyway to tag/bring a Unity Team Member in here to clarify the issue? I've been searching the forums and there are other java lang issues but the stack trace in this thread is the same one I'm getting:

    Caused by java.lang.RuntimeException: Window couldn't find content container view
    at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:3882)
    at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3960)
    at com.android.internal.policy.impl.PhoneWindow.getDecorView(PhoneWindow.java:2070)
    at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3391)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2690)
    at android.app.ActivityThread.access$900(ActivityThread.java:188)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1530)
    at android.os.Handler.dispatchMessage(Handler.java:111)
    at android.os.Looper.loop(Looper.java:224)
    at android.app.ActivityThread.main(ActivityThread.java:5836)
    at java.lang.reflect.Method.invoke(Method.java)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1113)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:879)

    Is this really caused by the Facebook SDK?
     
  15. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    I don't think it's actually related to Unity. The problem is started after migrating from support lib to AndroidX.
    I have zero clues what exactly causing it, my best guess that it's some wild libs cocktail.
     
  16. Temka_193

    Temka_193

    Joined:
    Oct 24, 2015
    Posts:
    47
    If it helps someone..
    I have this error reproduced in two cases. When the authorization window for Google Play Games opens, and the second case when the IAP window opens.
    But this does not play back constantly, I have to call the IAP window 100 times so that a crash occurs once.
    Important Note: If I delete the FacebookSDK, the crashes disappear.
     
  17. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    I have similar reports that it's happening when opening Google Play or IAP UI
     
  18. phuongnh

    phuongnh

    Joined:
    Sep 23, 2019
    Posts:
    22
    It sounds similar to me. I did not remove Facebook SDK completely, just not initialize Facebook on Android 5 & 6. Although those crashes are decreased significantly, after several days, these crashes come back (with less cases, on some Android 6 devices).
    Note: I also use Google Play Games in our games, so maybe that's the reason?
     
  19. Temka_193

    Temka_193

    Joined:
    Oct 24, 2015
    Posts:
    47
    No, GPGS is not affected by crashes. Moreover, we have games where the same plugins are installed, the same versions and they have no crashes.
    I tried to remove all calls to "FB.LogAppEvent", at first glance the crashes disappeared (for some devices)
     
    Last edited: Jan 15, 2020
  20. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    I also have reported that crashes are stopped after the FB SDK is removed from the project.
    Stop using SDK API for Android 5 & 6 might be the way to go.
     
    Nolex likes this.
  21. Temka_193

    Temka_193

    Joined:
    Oct 24, 2015
    Posts:
    47
    Yes, I confirm that the lack of initialization of Facebook on Android 5, 6 eliminates crashes.
     
    Nolex likes this.
  22. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Well, let's send reports to FB. That's the best chance to get it fixed in the upcoming FB SDK updates.
     
    Nolex likes this.
  23. phuongnh

    phuongnh

    Joined:
    Sep 23, 2019
    Posts:
    22
    More logs on my BlueStack (not crashed):

    Code (CSharp):
    1. 7620 I AppCompatDelegate: Failed to instantiate custom view inflater android.support.v7.app.AppCompatViewInflater. Falling back to default.
    2. 7620 I AppCompatDelegate: java.lang.ClassNotFoundException: android.support.v7.app.AppCompatViewInflater
    3. 7620 I AppCompatDelegate:     at java.lang.Class.classForName(Native Method)
    4. 7620 I AppCompatDelegate:     at java.lang.Class.forName(Class.java:400)
    5. 7620 I AppCompatDelegate:     at java.lang.Class.forName(Class.java:326)
    6. 7620 I AppCompatDelegate:     at tb.a(:com.google.android.gms@19831023@19.8.31 (040800-284611645):5)
    7. 7620 I AppCompatDelegate:     at tb.onCreateView(:com.google.android.gms@19831023@19.8.31 (040800-284611645):1)
    8. 7620 I AppCompatDelegate:     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:769)
    9. 7620 I AppCompatDelegate:     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
    10. 7620 I AppCompatDelegate:     at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
    11. 7620 I AppCompatDelegate:     at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
    12. 7620 I AppCompatDelegate:     at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
    13. 7620 I AppCompatDelegate:     at com.android.internal.policy.DecorView.onResourcesLoaded(DecorView.java:1819)
    14. 7620 I AppCompatDelegate:     at com.android.internal.policy.PhoneWindow.generateLayout(PhoneWindow.java:2555)
    15. 7620 I AppCompatDelegate:     at com.android.internal.policy.PhoneWindow.installDecor(PhoneWindow.java:2628)
    16. 7620 I AppCompatDelegate:     at com.android.internal.policy.PhoneWindow.getDecorView(PhoneWindow.java:2047)
    17. 7620 I AppCompatDelegate:     at tb.y(:com.google.android.gms@19831023@19.8.31 (040800-284611645):9)
    18. 7620 I AppCompatDelegate:     at tb.c(:com.google.android.gms@19831023@19.8.31 (040800-284611645):6)
    19. 7620 I AppCompatDelegate:     at dvh.setContentView(:com.google.android.gms@19831023@19.8.31 (040800-284611645):1)
    20. 7620 I AppCompatDelegate:     at com.google.android.gms.common.account.AccountPickerChimeraActivity.onCreate(:com.google.android.gms@19831023@19.8.31 (040800-284611645):28)
    21. 7620 I AppCompatDelegate:     at com.google.android.chimera.Activity.publicOnCreate(:com.google.android.gms@19831023@19.8.31 (040800-284611645))
    22. 7620 I AppCompatDelegate:     at qzv.onCreate(:com.google.android.gms@19831023@19.8.31 (040800-284611645):7)
    23. 7620 I AppCompatDelegate:     at android.app.Activity.performCreate(Activity.java:6787)
    24. 7620 I AppCompatDelegate:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1146)
    25. 7620 I AppCompatDelegate:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2619)
    26. 7620 I AppCompatDelegate:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2727)
    27. 7620 I AppCompatDelegate:     at android.app.ActivityThread.-wrap12(ActivityThread.java)
    28. 7620 I AppCompatDelegate:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1478)
    29. 7620 I AppCompatDelegate:     at android.os.Handler.dispatchMessage(Handler.java:102)
    30. 7620 I AppCompatDelegate:     at android.os.Looper.loop(Looper.java:154)
    31. 7620 I AppCompatDelegate:     at android.app.ActivityThread.main(ActivityThread.java:6125)
    32. 7620 I AppCompatDelegate:     at java.lang.reflect.Method.invoke(Native Method)
    33. 7620 I AppCompatDelegate:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:893)
    34. 7620 I AppCompatDelegate:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:783)
    35. 7620 I AppCompatDelegate: Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.app.AppCompatViewInflater" on path: DexPathList[[zip file "/system/framework/com.android.location.provider.jar", zip file "/system/framework/com.android.media.remotedisplay.jar", zip file "/data/app/com.google.android.gms-2/base.apk"],nativeLibraryDirectories=[/data/app/com.google.android.gms-2/lib/x86_64, /data/app/com.google.android.gms-2/base.apk!/lib/x86_64, /system/lib64, /vendor/lib64, /data/downloads, /data/priv-downloads]]
    36. 7620 I AppCompatDelegate:     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    37. 7620 I AppCompatDelegate:     at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
    38. 7620 I AppCompatDelegate:     at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    39. 7620 I AppCompatDelegate:     ... 32 more
    Gradle:
    implementation 'com.android.support:appcompat-v7:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
     
  24. Temka_193

    Temka_193

    Joined:
    Oct 24, 2015
    Posts:
    47
    I don’t know where to write. Also, according to reviews on the Internet, they do not respond.
     
  25. faveris_dt

    faveris_dt

    Joined:
    Sep 13, 2017
    Posts:
    6
    Nolex and stanislav-osipov like this.
  26. Nolex

    Nolex

    Joined:
    Dec 10, 2010
    Posts:
    116
    It looks like Facebook SDK still has problems. :mad:

    I have tested two versions (7.18.0 and 9.0.0).
    Crash:

    Code (CSharp):
    1. I/Unity(8168): Using Facebook Unity SDK v9.0.0 with FBAndroidSDK/9.0.0
    2. W/Unity(8168): !!! [Play Games Plugin DLL] 03/05/21 15:31:11 +02:00 WARNING: Creating new PlayGamesPlatform
    3. W/Unity(8168):
    4. W/Unity(8168): (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
    5. E/AndroidRuntime(8168): FATAL EXCEPTION: main
    6. E/AndroidRuntime(8168): Process: com.xxxxxxxxxxxxxxxxxxxx, PID: 8168
    7. E/AndroidRuntime(8168): java.lang.Error: FATAL EXCEPTION [main]
    8. E/AndroidRuntime(8168): Unity version     : 2019.2.12f1
    9. E/AndroidRuntime(8168): Device model      : LGE Nexus 4
    10. E/AndroidRuntime(8168): Device fingerprint: google/occam/mako:5.1.1/LMY48T/2237560:user/release-keys
    11. E/AndroidRuntime(8168): Caused by: java.lang.RuntimeException: Window couldn't find content container view
    12. E/AndroidRuntime(8168):     at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:3611)
    13. E/AndroidRuntime(8168):     at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3677)
    14. E/AndroidRuntime(8168):     at com.android.internal.policy.impl.PhoneWindow.getDecorView(PhoneWindow.java:1943)
    15. E/AndroidRuntime(8168):     at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3043)
    16. E/AndroidRuntime(8168):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)
    17. E/AndroidRuntime(8168):     at android.app.ActivityThread.access$800(ActivityThread.java:151)
    18. E/AndroidRuntime(8168):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
    19. E/AndroidRuntime(8168):     at android.os.Handler.dispatchMessage(Handler.java:102)
    20. E/AndroidRuntime(8168):     at android.os.Looper.loop(Looper.java:135)
    21. E/AndroidRuntime(8168):     at android.app.ActivityThread.main(ActivityThread.java:5254)
    22. E/AndroidRuntime(8168):     at java.lang.reflect.Method.invoke(Native Method)
    23. E/AndroidRuntime(8168):     at java.lang.reflect.Method.invoke(Method.java:372)
    24. E/AndroidRuntime(8168):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
    25. E/AndroidRuntime(8168):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

    Any ideas?
     

    Attached Files:

    Last edited: Mar 5, 2021
  27. Nolex

    Nolex

    Joined:
    Dec 10, 2010
    Posts:
    116
    Fix:

    Code (CSharp):
    1.     /// <summary>
    2.     /// iOS - all devices, Android - API > 23
    3.     /// </summary>
    4.     /// <returns></returns>
    5.     public static bool IsFacebookAvailable()
    6.     {
    7.         bool isAvailable = true;
    8.  
    9. #if UNITY_ANDROID
    10.         // Example: "Android OS 7.1.1 / API-25 (N4F27P/4333386)";
    11.         string ver = SystemInfo.operatingSystem;
    12.         int indexAPI = ver.IndexOf("API-");
    13.         if (indexAPI > 0)
    14.         {
    15.             ver = ver.Substring(indexAPI + 4, 2);
    16.  
    17.             int versionInt = 0;
    18.             bool success = int.TryParse(ver, out versionInt);
    19.             if (success && versionInt <= 23) isAvailable = false;
    20.         }
    21. #endif
    22.  
    23.         return isAvailable;
    24.     }
     
    UniDro likes this.