Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Crash after WRITE_EXTERNAL_STORAGE runtime permission on Android 6 devices

Discussion in 'Android' started by Gamba, Jan 20, 2016.

  1. Gamba

    Gamba

    Joined:
    Feb 8, 2015
    Posts:
    29
    Hi,

    We're performing an update on our app and we need to target Android SDK 23. After downloading the app from the Google Play store, and allowing the permission, the app immediately exits (log below, more detailed log attached). I should note that if I install the APK locally using ADB, and allow the OBB downloader do it's job, the OBB downloads and the app runs with no issues. This only happens when downloading from the store, which seems to download the APK and OBB at the same time. Perhaps the downloader isn't handling the runtime permission correctly when the OBB already exists? Any ideas would be great.

    Our environment:
    Unity 4.7.0f1 (we cannot currently upgrade to 5.x).
    Unity OBB downloader.
    Android SDK 23 (Marshmallow).
    Google Play Store beta app.

    Log:
    01-21 02:39:48.455: I/WindowState(776): WIN DEATH: Window{403c5bf u0 com.myCompany.myApp/com.myCompany.myApp.UnityPlayerNativeActivity}
    01-21 02:39:48.455: W/WindowManager(776): Force-removing child win Window{cb2a045 u0 SurfaceView} from container Window{403c5bf u0 com.myCompany.myApp/com.myCompany.myApp.UnityPlayerNativeActivity}
    01-21 02:39:48.458: W/WindowManager(776): Failed looking up window
    01-21 02:39:48.458: W/WindowManager(776): java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@c95948c does not exist
    01-21 02:39:48.458: W/WindowManager(776): at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:8736)
    01-21 02:39:48.458: W/WindowManager(776): at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:8727)
    01-21 02:39:48.458: W/WindowManager(776): at com.android.server.wm.WindowState$DeathRecipient.binderDied(WindowState.java:1209)
    01-21 02:39:48.458: W/WindowManager(776): at android.os.BinderProxy.sendDeathNotice(Binder.java:558)
    01-21 02:39:48.458: I/WindowState(776): WIN DEATH: null
    01-21 02:39:48.464: I/Zygote(210): Process 16110 exited cleanly (1)
    01-21 02:39:48.466: W/SurfaceFlinger(192): couldn't log to binary event log: overflow.
    01-21 02:39:48.474: I/ActivityManager(776): Process com.myCompany.myApp (pid 16110) has died
     

    Attached Files:

  2. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,559
    How are you sure that the permissions are what is causing the crash? From the log i couldn't see anything interesting (it does say that it presented the dialog for granting permissions, is that correct? are you able to see that dialog?)

    Also, where is Unity's log ? i can't see any output from the game ... Unity will usually output some stuff to the log on startup.
     
  3. Gamba

    Gamba

    Joined:
    Feb 8, 2015
    Posts:
    29
    I'm basing it on that fact that I'm targeting Android SDK 23 and on an Android 6 device. It didn't happen on 6 before we started targeting 23 and it doesn't happen on Android 5, even while we were still using Unity 4.7.

    The crash itself happens right after you allow the permission, and before the Unity engine is started, but I'm assuming it's still Unity's code that calls and handles the permission request.

    So after pouring through Android documentation last night, which I'm not very familiar with, it seems that some activity is failing to re-bind after the process is re-mounted with write permissions. Unfortunately, I have no idea what that activity is based on the log.
     
  4. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,559
    Do you have a full log of this entire scenario? Also, what permissions are you declaring in your AndroidManifest.xml ? maybe you are missing some needed permissions ?
     
  5. David_Knopp

    David_Knopp

    Joined:
    Jul 10, 2013
    Posts:
    10
    I'm seeing the same crash - has anyone found more information on this?