Search Unity

PlayerStore .apk + .obb loaded but cannot load scene

Discussion in 'Android' started by crypt0, May 12, 2017.

  1. crypt0

    crypt0

    Joined:
    May 25, 2015
    Posts:
    55
    Hi,

    I have uploaded a beta version of my app to the Google PlayStore. I splitted the app into a .apk and .obb file with the unity PlayerSettings option. Then, I renamed the apk file to com.companyname.appname.apk and the .obb file to main.6.com.companyname.appname.obb. 6 is my Bundle Version (I tested it to upload a version with 1 but google changed the name automatically to the current bundle version).

    I uploaded both files to the Playstore by creating a new bet version. (That was yesterday). So, when I download the app, it downloaded the .apk and the .obb file. I can see the .obb in:

    InternalStorage/Android/obb/com.companyname.appname/main.6.com.companyname.appname.obb

    I started the app and want to load a second scene, but nothing happens, the app crashed. This morning I started the app and it works -_- on two devices. Then, I uninstalled the app on one device, downloaded it from the Google PlayStore and....it doesn't work again. What the hell is that?

    If I use the Build and Run option in Unity, it works - and the obb file is on the same location with the same name, as I downloaded it from the PlayStore.

    I have read some articles

    https://docs.unity3d.com/Manual/android-OBBsupport.html

    https://developer.android.com/google/play/expansion-files.html

    What's going wrong? What can I do?

    Thanks and Cheers
     
  2. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    There was an issue reported when the OBB doesn't work until you reboot your phone. Check if this is true, if it is - you might require additional permissions, probably READ_EXTERNAL_STORAGE or WRITE_EXTERNAL_STORAGE (dangerous permission).

    I didn't have a clear evidence and repro of this issue - so can't tell you for sure or fix it properly.
     
  3. crypt0

    crypt0

    Joined:
    May 25, 2015
    Posts:
    55
    Hi,

    I tested it - I restarted my smartphone an started the app and it works. Then I uninstalled it again, downloaded it from the playstore, start the app -> crash. I started the app again without a smartphone restart and it works o_O I uninstalled it, downloaded, installed and start -> crash. Restart app, it works...:eek:

    That#s really strange!

    Okay, but why EXTERNAL? My file is stored on the internal storage.

    Cheers
     
  4. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    The OBB gets downloaded to the external storage.
    Can you please check with the permissions and say whether it works for you with either of the permissions?
     
  5. nail_safin

    nail_safin

    Joined:
    Oct 31, 2016
    Posts:
    14
    The same problem. Do you have solution?
     
  6. nail_safin

    nail_safin

    Joined:
    Oct 31, 2016
    Posts:
    14
  7. crypt0

    crypt0

    Joined:
    May 25, 2015
    Posts:
    55
    Hi,

    I added the READ_EXTERNAL_STORAGE permission to my Manifest file and it works.

    Thanks and Cheers
     
    DBarlok and Yury-Habets like this.
  8. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    @crypt0 thanks for the heads up!
     
    DBarlok likes this.
  9. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    155
    I have added READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE and it's still not working for me. I have tried with unity 5.6.0p4, and 5.6.2p4. When I build to the phone it works fine, but when I upload it to google play and download from there I can't get to any data in the OBB until I restart the phone.
     
    DBarlok likes this.
  10. hacaro76

    hacaro76

    Joined:
    Oct 14, 2015
    Posts:
    25
    Hi Guys, i’m stucking on a similar problem with my project. I’ve used the latest plugin at Over17 Github repository for my project. My project has a first scene(0) with the obbdoebloadexample script and a coroutine that load the scene(1) after the FetchOBB. All the download part works fine, and the OBB is properly downloaded in the right path. Unfortunately, it does not load the scene(1). I get a nlack screen. I’ve attached the debug in android studio and i receive an error unable to extract assetbundle at file:///Android/obb/packagename/main.2.packagename.obb. I’ve also in my manifest the READ AND WRITE PERMISSION. And the taglrget set to api 26 according with the latest version of plugin. So, i think that something is wrong in my inplementation. There is someone that can share an example of working download script that load next scene after obb fetch ? I’ve also tried to restart the phone as i read in this post, but nothing changes. I’m not a better programmer and i mindly ask if someone can help me sharing a working code for this part in order to be sure that the code works. Hoping that someone can help me for this urgent task because my app needs to be published on this week. Thanks in advance to all. Best regards Max
     
    DBarlok likes this.
  11. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    Maybe more details about your error will be helpful - like, logcat of the error and few entries around.
     
  12. Dover8

    Dover8

    Joined:
    Aug 20, 2010
    Posts:
    94
    I've been having the same issue. The solution, though strange, was to remove my AndroidManifest file from within Unity. Unity generated it's own file and there should be no need to replace it with your own.
     
  13. DBarlok

    DBarlok

    Joined:
    Apr 24, 2013
    Posts:
    268
    Hello, first of all thanks for the GitHub plugins and all the threads to reach OBB status (almost)! :)

    Im since 2 hours thinking why my game doesn't want to load an Scene,
    with OBB in the middle.
    (game is published on Google Play and working, i want to do an update).

    It seems i've followed all steps (2 days or more but all super clear) with Split APK, AndroidPermissionsUsageExample, DownloadOBBExample and Uploading everything to Google Play in Beta.

    I've managed to Download my first 25mb APK and the OBB (192mb).

    Version number, good.
    All seems good.

    I download from Beta as a Tester. I update my game, Unity Starts,
    i see the Permissions Dialog, i agree.

    OBBDownloader starts (i feel OBB was already downloaded by google
    but the OBBDownloader starts anyway, i will check that part)
    and the OBB seems to be there.

    I run inside one of my scripts this as one user posted to check SceneNames:

    public void PrintSceneNames()
    {
    for (int i = 0; i < SceneManager.sceneCountInBuildSettings; i++)
    {
    var path = SceneUtility.GetScenePathByBuildIndex(i);
    var sceneName = System.IO.Path.GetFileNameWithoutExtension(path);
    Debug.Log(sceneName);
    escenas.text+="\n" + sceneName;
    }
    }


    ...And i see all the Scenes inside the OBB. BUT, it doesn't load what is working
    without OBB. (im testing it without OBB and the scene is right).

    If i erase the App and i dont install the OBB (installing my first 25mb APK manually over
    Airdroid), the Scenes are not there. So, that means, Unity and Android is reading
    the OBB and content. (in theory).

    Now, as im unable to see LogCat (i've tried many) as this is not a Rooted Phone
    and ADB filtered with Unity doesn't show me nothing more than Samsung data,
    THEN,

    Im stuck. :eek::eek:

    Any clue why my game doesn't load now? It seems im unable to make both OBB work
    and now without Logs...o_O

    ...please help! :)

    Update: i see the OBB inside Android/OBB/mygame/...

    It was downloaded on Internal Storage.

    Why it doesn't load the Scene? . . . :(

    Update (after coffe and 2 hours more): At least im seeing LogCat over ABD with... (to others having the same silly situation of not seeing logs when you stump with OBB and you don't remember even your name):
    adb logcat -s Unity ActivityManager PackageManager dalvikvm DEBUG

    Trying to make the OBB work, more data:
    https://issuetracker.google.com/issues/37075181

    Update: I keep stuck with the OBB loading something....no matter what.
     
    Last edited: Jul 26, 2018
  14. Dover8

    Dover8

    Joined:
    Aug 20, 2010
    Posts:
    94
    Have you tried restarting the phone after downloading the OBB from the store? I've seen a strange permission issue with reading from the OBB, but restarting the phone has always seemed to sort this. It also only seems to affect apps while in Beta mode...
     
  15. DBarlok

    DBarlok

    Joined:
    Apr 24, 2013
    Posts:
    268
    Hi Dover8, nice to meet you.

    Yes, i tried and tried and i will keep trying. :)

    Im pushing with Build&Run and doing some checklists until
    i found the thing.

    Sometimes, it loads...sometimes, it not...
     
  16. DBarlok

    DBarlok

    Joined:
    Apr 24, 2013
    Posts:
    268
    Hi Yuri-Habets

    After more research i have some doubts.

    - It's API 19 good for the Permissions to work inside Android 6 or do we need to go up to API 22-23?

    - Do we have to put Write External Storage inside Build Settings?

    Thanks!
     
  17. DBarlok

    DBarlok

    Joined:
    Apr 24, 2013
    Posts:
    268
    Hi Dover8,

    What do you mean by removing Android Manifest? :D

    Did you built just with the Staging Area one that gets merged ?


    Update about this: If i desinstall the Game and put Build&Run (with Split, permissions, everything), it works. Lol. Now let's try again with the AndroidPermission Plugin and DownloaderPlugin (that doesn't worked before to me, sorry my english). This is of course, an Android Bug as stated everywhere. Pew.

    Update again: Now without changing nothing just the order of some scene, im getting
    "Unable to convert Classes to Dex...". Sometimes i receive this one. So, maybe the SDK Tools needs to be Updated now (after backup) and maybe some plugin is crashing everything.

    Update Update: Now it seems to work....something is unstable with SDK Build-Tools 25
    and Unity 5.6. Maybe is time to me to Update as i think in the future you are with 2018 :cool:.
    I didn't changed anything and now it runs!!! (at least 1 time, i will keep testing before updating this to players).

    What it works:

    DownloaderOBB plugin: Downloads ok, Checks Path ok, as expected.

    AndroidPermissions Plugin: It asks for them, it works (no restart phone here), as expected.

    Some Google bug maybe...

    Now i will commit this to Google maybe tomorrow and i round this post with
    my experience with this.

    What a long journey! Thanks Yuri-Habets and everyone! If it doesn't work
    tomorrow, i will keep with testing and checklists as now i think i understand
    a little more.

    Update Update Update: Ok, it works. :):)
     
    Last edited: Jul 27, 2018
    a_gebenroth likes this.