Search Unity

Android .OBB Magic

Discussion in 'Android' started by Ogien, Aug 18, 2018.

  1. Ogien

    Ogien

    Joined:
    Nov 21, 2012
    Posts:
    156
    I have reached the point where my app can no longer fit into 100MB. I have no choice but to figure out how to use .OBB expansion files on Google Play. However I am having trouble locating a recent tutorial.

    I found the Unity Help File

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

    However when I read the comments on the store for this plugin it seems obsolete and has issues with newer versions of Unity.

    On the other hand I found some posts with people claiming that Google Play now handles the .OBB download automatically and you no longer need this plugin. However that approach seems to have some permission related issues as well a device related issues.

    Does anyone have recent experience with .OBB files for Google Play and can they please teach me this magic. I really don't want to screw this up for my users.

    Thank you
     
    Qbit86 likes this.
  2. Ogien

    Ogien

    Joined:
    Nov 21, 2012
    Posts:
    156
    Anyone?
     
    Qbit86 likes this.
  3. unity_NTp4drjeeuMCuQ

    unity_NTp4drjeeuMCuQ

    Joined:
    Aug 17, 2018
    Posts:
    2
    I am having the same problem and I urgently need to publish the application!

    Already tried:
    - 'Install Location' = Prefer External;
    - 'Write Permission' = External (SDCard);
    - Some solutions said to put "android.permission.READ_EXTERNAL_STORAGE" directly in AndroidManifest.xml, but it was already activated (probably due to the previous option);
    - Put the plugin 'UnityOBBDownloader', which in theory would be the best option, but without success.
     
  4. Ogien

    Ogien

    Joined:
    Nov 21, 2012
    Posts:
    156
    I am shocked that such an important feature is so poorly documented/supported, we must me missing something.
     
  5. Ogien

    Ogien

    Joined:
    Nov 21, 2012
    Posts:
    156
    So this is what I found so far using some trial and error.

    Google will deploy the .OBB file automatically once you upload it. However their documentation states that sometimes if the OBB deployment fails your app still needs to download the OBB files. So it seems that there still is a need for that plugin.

    So I am now working on testing the Unity Plugin but I am worried that my testing devices arsenal is not going to provide good enough test coverage.

    It would be awesome to have someone from Unity confirm that this plugin is still supported and has been tested since Unity 4.
     
  6. Ogien

    Ogien

    Joined:
    Nov 21, 2012
    Posts:
    156
    I build a new test version with an OBB file and the Unity Plugin from the documentation.

    1. First the new version of my app now requires access to Call ID and Call History, definitely not good.
    2. The app runs fine with the plugin and a "Loading Scene" that checks for the OBB and downloads it. The OBB was already there so really there was nothing for the plugin to do.
    3. As a final test I deleted the OBB file from the phone to see if I can download it. Unfortunately when I did that the app crashed. I can see the download progress screen at 0% then I get the "Unfortunately, AppName has Stopped"

    This does not bode well. Anyone from Unity?
     
  7. unity_NTp4drjeeuMCuQ

    unity_NTp4drjeeuMCuQ

    Joined:
    Aug 17, 2018
    Posts:
    2
    Have you entered your App's BASE64_PUBLIC_KEY into the 'GooglePlayDownloader.cs' Script?
     
  8. Ogien

    Ogien

    Joined:
    Nov 21, 2012
    Posts:
    156
    Yes I did
     
  9. Ogien

    Ogien

    Joined:
    Nov 21, 2012
    Posts:
    156
    After some soul searching I decided that it is much safer to simply do a deep dive on my game's assets and shrink the APK down to under 100MB. Its probably better for performance anyways to have smaller assets and I was not ready to take such a huge risk on this OBB plugin.

    However this is a short term solution, soon I will want to ad more content to my game and I will face the same problem so I would appreciate any help, code, links to tutorials or even a simple confirmation that it still works in 2018.
     
  10. matimark

    matimark

    Joined:
    Jun 1, 2015
    Posts:
    1
    Hi Ogien, did you manage to find a solution? Or did you go with a <100mb solution?
     
  11. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,074
    Avoiding using an OBB is a great solution, if you can make it. Try utilizing asset bundles for delivering additional assets and/or updates.

    As an alternative, try using the new Android App Bundles https://developer.android.com/platform/technology/app-bundle/ (should be available in latest Unity 2017.4 too) - it's a more optimized delivery mechanism, with potential to support more than 100Mb limit.
     
  12. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    I have OBB loader in my older game and everything works. But now I need it for another game and OBB loader crashes with this screen: Looking for recources to download.



    I waited a day to see if the OBB file just was not ready on Google's end, but it just keeps crashing. I have done everything just like with the other app that works.

    You wrote that "First the new version of my app now requires access to Call ID and Call History, definitely not good."

    My other game that uses the same OBB loader and actually works, gave me very serious warning. If I undersood correctly Google Play will remove all apps that access Call ID and Call History in March 9th!

    There is an blog about it:

    https://android-developers.googleblog.com/2019/01/reminder-smscall-log-policy-changes.html

    "We'll be removing apps from the Google Play Store that ask for SMS or Call Log permission and have not submitted a Permissions Declaration Form."

    So I quess all the apps that use OBB downloader will be removed soon from Google Play if the developer has not noticed this Permissions Declaration Form. I noticed it myself by accident, no notification from Google. Just this warning that I saw once on the console.
     
  13. Ogien

    Ogien

    Joined:
    Nov 21, 2012
    Posts:
    156
    With App bundles now supported in Unity and a 500MB App Bundle Limit is this still an issue (unless your game is larger then 500MB)
     
  14. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    6,445
    It is an issue, yes. (and the 500mb apk thing hasn't happened yet)
     
  15. Ogien

    Ogien

    Joined:
    Nov 21, 2012
    Posts:
    156
  16. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    6,445
    Did you not read the known issues section?
     
  17. Ogien

    Ogien

    Joined:
    Nov 21, 2012
    Posts:
    156
    Well that sucks, what is the point of having the 500MB upload limit then :(
     
  18. jason_yak

    jason_yak

    Joined:
    Aug 25, 2016
    Posts:
    303
    It has happened but it is in an early roll out phase where you need to be whitelisted in order to gain approval for 500mb. You have to talk to your google play contact and they might be able to apply on your behalf to get you whitelisted.
     
  19. jason_yak

    jason_yak

    Joined:
    Aug 25, 2016
    Posts:
    303
    satchell likes this.
  20. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,194
    it's still not activated. I've tried an app bundle upload of 220mb and google rejected it because it was too large.
     
  21. jason_yak

    jason_yak

    Joined:
    Aug 25, 2016
    Posts:
    303
    Yea I have a feeling that google gone back on this 500mb feature in favour of everyone using the AAB format and have things setup so your app will split in to multiple apk files each under 100mb ie. not using OBB expansion files.
     
  22. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,074
    Yep 500Mb seems to have been in "test mode", now back to 150Mb OTA size. (OTA means it's less than the AAB size, you could use bundletool to calculate OTA size. Unity must have the functionality to check the same if your AAB size is larger than 150Mb)
     
  23. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,194
    Yep, it is larger. The issue is that... what do we do then? I mean, if our game is over 150 megas (which it is), we cannot use the AAB format. We are then forced to OBB, but they are declared obsolete on Unity (the obbdownloader is not even on the asset store any more).
     
  24. jason_yak

    jason_yak

    Joined:
    Aug 25, 2016
    Posts:
    303
    AAB format has functionality to split out into multiple APK files, this is the replacement for OBB files at least on the native Google Play side of things. I've not moved over to this format but that's what I'm expecting we'll have to do as our app is way over at 372mb total.

    Little bit concerned about known issue of assets taking considerably longer to load when using AAB though: https://issuetracker.unity3d.com/is...017.139934630.1575246583-970816431.1563260025
     
  25. jason_yak

    jason_yak

    Joined:
    Aug 25, 2016
    Posts:
    303
    It's a good thing that OBB files have been deprecated though. Having had to deal with the various technical issues and bugs with OBB files I'm not sad to see them go. There are so many installation issues with them that will never be fixed.

    Here's some info on the AAB format for dynamic delivery of content. It's going to be a huge job to support this format though, I'm yet to tackle this... sigh.

    https://developer.android.com/studio/projects/dynamic-delivery
     
  26. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    515
    It's not all assets, but assets from the asset bundles. The workaround is to use lowercase letters when naming your asset bundles and if you place them inside a subfolder (not directly in StreamingAssets folder), then use lowercase letters for that subfolder as well.
     
    jason_yak likes this.
  27. jason_yak

    jason_yak

    Joined:
    Aug 25, 2016
    Posts:
    303
    Thanks for those tips, we would be using asset bundles but that's an easy workaround, cheers!
     
  28. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,194
    Well, AAB format may have the functionality to split out into multiple APK... but it doesn't do it in Unity. My AAB is over 220mb and google tells me to go to hell with it. So it seems there is no viable solution for large projects unless you do asset bundles... and that has the huge issue of where do you host them and at what cost.
     
    AcidArrow likes this.
  29. jason_yak

    jason_yak

    Joined:
    Aug 25, 2016
    Posts:
    303
    I thought google would host them just like they host OBB files. But haven’t looked in to this.

    With AAB splitting, I’m expecting this to be up to us to do using an android studio project and gradle settings where we designate which assets will go in the dynamically delivered apk’s. Which for me will be a bunch of asset bundles. All of this why I’m expecting it to be a huge job.
     
  30. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,194
    No, google doesn't host it like that. Or at least Unity is not able to generate multiple AAB from the same game. So no, right now it's either OOB or nothing. And OOB downloader is not available on the store any more. So basically your unity game has to be under 150mb. Any large games you have to go through a nightmare scenario to be able to publish it.
     
  31. jason_yak

    jason_yak

    Joined:
    Aug 25, 2016
    Posts:
    303
    Sorry I'm not sure if that's correct. From how I understand it you setup your android studio app for delivery using dynamically delivered modules so that it will compile out split multiple apk's, if you were to run and install this to a local test device it will install all of the multi-apk's, for delivery to Google Play you're to upload the AAB format which is meant to take care of the multiple apk's.

    https://codelabs.developers.google.com/codelabs/on-demand-dynamic-delivery/index.html#5
     
  32. jason_yak

    jason_yak

    Joined:
    Aug 25, 2016
    Posts:
    303
    But I agree that it is most certainly a nightmare to deal with. I'm expecting the effort to change over to take weeks.
     
  33. jason_yak

    jason_yak

    Joined:
    Aug 25, 2016
    Posts:
    303
  34. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,194
    Yes, but we are using Unity. Not Android Studio. That's the point. Of course I could use third party tools or write my own OBB downloaded (which I had, so I was able to release large files). But the point here is that we should not need to worry about it. Unity should be able to build, create the needed files and upload them to the store.
     
  35. jason_yak

    jason_yak

    Joined:
    Aug 25, 2016
    Posts:
    303
    Yea it would be nice if this was dealt with because it’s going to be potentially weeks of effort repeated by every dev with a game over 150mb.
     
  36. tomekswk

    tomekswk

    Joined:
    Jun 11, 2015
    Posts:
    19
    Just gonna throw in about OBB's here - there is a particulary nasty bug in Android 6 that causes the app to set file permissions on the downloaded OBB such that the game can not access the file, so you might have to work around that.

    If you can, use Asset Bundles, they're less of a pain to deal with.
     
  37. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,194
    yeah, i encountered that bug. The solution is to give write external permissions. Or on Unity set on build settings the "external sd card" access. Of course, you will get a popup on installation asking the user whether they want to give that permission.

    The Asset Bundle works, but then you have to find where to host them and build them separately with each release (plus write a system to download and install, and error checking and all the jazz).
     
unityunity