Search Unity

Google Play OBB Downloader

Discussion in 'Android' started by dustinbahr, Mar 7, 2013.

  1. dustinbahr

    dustinbahr

    Joined:
    Sep 10, 2012
    Posts:
    57
    I am trying to get my app on the Google Play store. It is well over the 50MB limit at around 250MB.

    I have followed the tutorial found here: http://labs.exoa.fr/tutorial-unity-4-apk-splitting-google-play-obb/

    This worked great when I started fresh with a new project, both in Unity and on Google Play.

    However, when I try to implement it in my existing project I get an error:

    This happens after I click the download button in the example.

    Any way to narrow down what setting I need change to get this working?

    The only hint I have is that I am using several prime31 plugins along with the Google Play OBB Downloader plugin. They both seem to want to modify the AndroidManifest.xml file, along with styles.xml, strings.xml, and main.xml. I have done my best to merge these manually, however I'm not really sure what some of it is doing.

    Any help would be appreciated!
     
    korchagindm likes this.
  2. musikit

    musikit

    Joined:
    Jan 30, 2012
    Posts:
    160
    i used the same one and had no issues at all. recommend you check your google settings.
     
  3. jareds

    jareds

    Joined:
    May 8, 2008
    Posts:
    207
    Hey folks,

    I'm having a similar problem. Have you made any progress on this? We've never used the OBB downloader before and I'm not sure what settings could cause this problem.

    Thanks,
    Jared
     
  4. smartkiran

    smartkiran

    Joined:
    Mar 28, 2013
    Posts:
    10
    Hey guys,

    I have the same problem now. Is anyone able to resolve this ?

    Sometimes I get "Download failed because you may not have purchased this app"

    and sometimes I get "Download failed because the resources could not be found"
     
    Last edited: Apr 3, 2013
  5. StaticNova

    StaticNova

    Joined:
    Feb 23, 2013
    Posts:
    60
    "Download failed because resources could not be found" is due to propagation on Google's servers. You just need to wait a little longer before testing.
     
    JacksonTBM likes this.
  6. smartkiran

    smartkiran

    Joined:
    Mar 28, 2013
    Posts:
    10
    Ya, it works now. Thanks.
     
  7. mrSaig

    mrSaig

    Joined:
    Jan 14, 2010
    Posts:
    68
    Hey Guys i'm hoping you can help me ... i have following problem ... i set up a test project with a downloaderscene and a game scene

    the downloader scene contains the obbdownloaderexample from this tutorial http://labs.exoa.fr/tutorial-unity-4...ogle-play-obb/

    the downloaderscene trys to start the download ... after a few seconds it says that the download has finished
    but he it did not download anything ... is this supposed to happen since the App is not published yet or is there an error?

    Hope you can help me!
     
  8. kimbo

    kimbo

    Joined:
    May 24, 2013
    Posts:
    2
    I'm having the exact same problem.

    Except for me its clearly downloading my obb file but it doesn't appear to be saving it anywhere.

    the mainpath is /storage/emulated/0/Android/obb/ <bundle identifier>/ <obb file name>

    Cannot find the obb file or this folder on my device.

    I'm running on nexus 4 (android 4.2.2 )
     
  9. Straafe

    Straafe

    Joined:
    Oct 15, 2012
    Posts:
    73
    Also having this problem. Could this happen when the LVL is wrong or what could cause this? It can't be because I tried too soon after uploading the apk/obb, because that was 24 hours ago.
     
  10. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
    I just split the APK and upload the APK and the expansion file to Google Play. I didn't add the OOB downloader to my project but everything still works. No customer has complained. Not sure the OOB downloader is needed for Google Play.
     
  11. Straafe

    Straafe

    Joined:
    Oct 15, 2012
    Posts:
    73
    I think it's only needed in a minority of cases where the OBB file is not automatically downloaded (apparently some devices will not download the expansion at the same time). I want to make sure that in these cases the customer will be able to automatically download the OBB, but I'm having trouble with that.
     
  12. miniduck

    miniduck

    Joined:
    Sep 27, 2012
    Posts:
    117
    I will just ask here instead of creating a new thread.

    Is anyone else having problem RESUSING an OBB package?
    I bump bundle version and leave bundle version code but launching new build with the old obb on the proper place still gives "add level to build settings".
    Only way for me to getting it work properly is to bump OBB version as well - any ideas?
     
  13. Straafe

    Straafe

    Joined:
    Oct 15, 2012
    Posts:
    73
    I've always had to use the exact OBB that came with the APK every time I made any changes, otherwise always had that error. This was even in cases where the OBB's were the same version code, name, and exact file size. I'm currently waiting a couple hours to make sure google has correctly set my OBB to the newer one in order to do a quick test. Not sure if there are any workarounds for faster testing when you need to download it from google.
     
  14. miniduck

    miniduck

    Joined:
    Sep 27, 2012
    Posts:
    117
    All right, thanks straafe.
    Will put in a bug report - see what happens...

    Just got a one star rating saying "each update uses up 300MB more of sd card each time".... aaaarg sometimes I wish I could reach in to the screen and grab the person :D....
     
  15. Aurigan

    Aurigan

    Joined:
    Jun 30, 2013
    Posts:
    291
    In Unity 4.3 the plugin will crash the app/device any time it tries to do the download. I had to (re)install the 4.2.2 Unity to keep working on a project.
     
  16. GameForLife

    GameForLife

    Joined:
    Aug 17, 2013
    Posts:
    41
    How do I split the APK and upload it to google play? I have a game and it is only 64,245kb. Can you send me a tutorial so I can learn how to do it?
     
  17. HelloNan

    HelloNan

    Joined:
    Aug 10, 2012
    Posts:
    18
    I upload the apk and OBB to Google Play for about two days, but when I run the apk, I get "Download failed because the resources could not be found", how to solve this?

    I do a test demo as "http://labs.exoa.fr/tutorial-unity-4-apk-splitting-google-play-obb/". Is there some setting not right?
     
  18. Kennethljj

    Kennethljj

    Joined:
    Feb 13, 2013
    Posts:
    17
    You may want to do some coding in removing the old obb files. (That's what I did for my project)

    for(int i=1; i < currentAndroidVersionNo; i++)
    {
    string obbFile = string.Format("{0}/main.{1}.{2}.obb", obbPath, i, <package_name>);
    if (File.Exists(obbFile))
    {
    File.Delete(obbFile);
    }
    }

    This will delete all the unwanted (previous) obb files that is still on the device.

    You guys may want to take a look at this particular tutorial too. Hope it helps.
    http://smartkiran.wordpress.com/201...d-windows-also-works-on-mac-havent-tested-it/
     
    Last edited: Jan 21, 2014
  19. leegod

    leegod

    Joined:
    May 5, 2010
    Posts:
    2,476
    hi, so this tutorial link does not exist no more.

    http://labs.exoa.fr/tutorial-unity-4...ogle-play-obb/

    Has anyone know how to do it work at current environment? unity 4.3.4 newest.

    and asset store's unity official google obb downloader's reply, users says there are bugs on unity4.0

    then how should I do now?

    Thx.
     
  20. Zaddo67

    Zaddo67

    Joined:
    Aug 14, 2012
    Posts:
    489
    Bump.

    As Leegod mentioned, comments on the asset store for google obb downloader, say don't use it in Unity 4.0.

    Should you/shouldn't you use this asset? If not, what is the correct process for splitting APK and downloading OBB?

    Thx
     
  21. AYFukushima

    AYFukushima

    Joined:
    Feb 4, 2013
    Posts:
    12
    Hi!

    Anyone knows why the Google Play Downloader package has gone from Asset Store?

    Thanks!
     
  22. Dusty-ED

    Dusty-ED

    Joined:
    May 29, 2014
    Posts:
    3
    I'm also trying to track this down. I had this working in my project for months, and then all of a sudden my ooh files stopped downloading. I wanted to re-download the package and see if i had accidentally changed something, but I can't find it anywhere. Is the package still the way to do this or is there a better way now?
     
  23. wana7262

    wana7262

    Joined:
    Jul 2, 2012
    Posts:
    103
    Bump.... anyone can confirm this plugin working with latest unity? or 4.3.4
     
  24. babi

    babi

    Joined:
    Jan 27, 2014
    Posts:
    1
    For two weeks I was fighting this problem.

    My solution was to use a different browser to upload the obb.
    With Safari I had the problem that no obb file was found.
    The upload with Firefox works for me.

    You don't need to use the Google OBB Downloader-Asset.
    Split your app in unity3d.
    If your first scene is small enough, just upload the apk and the obb.
    Otherwise create an empty scene and put it in first position in build settings. In this scene you only have to load the next scene.

    When installing your app with Google Play your apk file and the matching obb file will be automatically downloaded and installed.
     
  25. jesusluvsyooh

    jesusluvsyooh

    Joined:
    Jan 10, 2012
    Posts:
    377
    Been looking all over the internet for this, its crazy how it does not auto delete old obbs, my players must have about 8 now (all around 60mb each) ah well, at least i found out and can now fix it! ^_^
    Thank you for being the only post within my 30mins search that had a solution!
     
  26. LandonC

    LandonC

    Joined:
    Dec 20, 2012
    Posts:
    83

    This is helpful, however it does not work in my case. I don't know about other platforms but on Android, the old obb file names aren't necessarily named in the same format. On my devices, some are named with temp.*something*.packagename.

    If you are using GoogleDownloader like me, you can get the version number from the plugin easily by changing the private static int to public at GoogleDownloaderImpl.cs to grab the ObbVersion at m_ObbVersion.

    Here's my code to delete all old OBBs for anyone else looking. There's not a lot of examples on the web.

    Code (CSharp):
    1. void DeleteOldOBB()
    2.     {
    3.         m_obbDownloader = GooglePlayObbDownloadManager.GetGooglePlayObbDownloader();
    4.         m_obbDownloader.PublicKey =  // YOUR PUBLIC KEY HERE
    5.    
    6.         string expPath = m_obbDownloader.GetExpansionFilePath();
    7.         var mainPath = m_obbDownloader.GetMainOBBPath();
    8.  
    9.         int obbVersion = GooglePlayObbDownloader.ObbVersion;
    10.  
    11.         if(expPath != null)
    12.         {
    13.             DirectoryInfo dir = new DirectoryInfo(expPath);
    14.             FileInfo[] info = dir.GetFiles("*.*");
    15.        
    16.             // The file exists -> run event
    17.             foreach (FileInfo f in info)
    18.             {
    19.                 if (f.Name == "main." + obbVersion + <package_name> + ".obb") //YOUR PACKAGE NAME HERE
    20.                 {
    21.                     //Don't do anything
    22.                     Debug.Log("Keep this " + f.Name);
    23.                 }
    24.                 else
    25.                 {
    26.                     // There are other files in this folder, delete them
    27.                     File.Delete(expPath + "/" + f.Name);
    28.  
    29. //To make sure it is deleted on android
    30. #if UNITY_ANDROID
    31.                     using (AndroidJavaClass jcUnityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
    32.                     using (AndroidJavaObject joActivity = jcUnityPlayer.GetStatic<AndroidJavaObject>("currentActivity"))
    33.                     using (AndroidJavaObject joContext = joActivity.Call<AndroidJavaObject>("getApplicationContext"))
    34.                     using (AndroidJavaClass jcMediaScannerConnection = new AndroidJavaClass("android.media.MediaScannerConnection"))
    35.                     using (AndroidJavaClass jcEnvironment = new AndroidJavaClass("android.os.Environment"))
    36.                     using (AndroidJavaObject joExDir = jcEnvironment.CallStatic<AndroidJavaObject>("getExternalStorageDirectory"))
    37.                     {
    38.                         jcMediaScannerConnection.CallStatic("scanFile", joContext, new string[] { expPath + "/" + f.Name }, null, null);
    39.                     }
    40. #endif
    41.                 }
    42.             }
    43.         }
    44.     }
    45.  
     
    Last edited: Oct 14, 2019
  27. ChiuanWei

    ChiuanWei

    Joined:
    Jan 29, 2012
    Posts:
    131
    so this way we don't need to care about the obb file was exist ?