Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

More Google OBB drama

Discussion in 'Android' started by bpritchard, May 8, 2012.

  1. bpritchard

    bpritchard

    Joined:
    Jan 29, 2009
    Posts:
    444
    Morning all!

    We've successfully integrated OBB loading into our app... and alls great in the world, until we submit to Google. Essentially they are recommending we do NOT decompress and store the assets from the OBB on the device but instead read directly from the bob at runtime. Is this even possible? We received a recommendation as follows...

    Is that even possible? The dev seems to think its something totally reasonable, but i question it as a load time solution. Any one have any experience with this sorta thing? Or a recommendation we can look at at loading from a stored location?
     
    Last edited: May 9, 2012
  2. HazeTI

    HazeTI

    Joined:
    Jan 12, 2012
    Posts:
    83
    I take it that you are, in fact, using Asset Bundles then? Have you tried using the Google Play OBB Downloader plugin available on the Asset Store? I believe this is a solution presented by Unity however it required 3.5.1.

    Just out of curiosity are you using Asset Bundles specifically to get around the 50mb limit or were you using them anyway?
     
  3. bpritchard

    bpritchard

    Joined:
    Jan 29, 2009
    Posts:
    444
    we actually integrated our own spin on the OBB loader before we realized there was one available in the asset store. :) So yes... we are using a single asset bundle that contains all of our data (this is a carryover from how we did side loading before the obb craziness). I haven't looked at the unity solution, but does it support streaming the assets w/o decompressing them to the destination cache directory? That seems to be what Google is "requesting" (understand this isn't a REQUIREMENT)... i dunno. Just seems like a lot of work just to get around the fact they don't support 50 meg +.

    And yes, we're doing this to get our app down in size... so basically everything is included in the obb and the apk is really small.
     
  4. HazeTI

    HazeTI

    Joined:
    Jan 12, 2012
    Posts:
    83
    I'm afraid I've not used it myself, we're using the "other" solution that's being passed around the forums. Using Floky's tool to create two .apk files and overriding the UnityPlayerActivity::getPackageCodePath to point to the correct location of the OBB file. That was a fair amount of work too, all to get around some ridiculous limitation.

    However, from conversations I've had my understanding is that is does support streaming the assets as you've mentioned. Again, I've not used it so I can't comment 100%. The asset store plugin has a readme which may provide you with some clue. Sorry I can't really help more :/
     
  5. bpritchard

    bpritchard

    Joined:
    Jan 29, 2009
    Posts:
    444
    No worries HazeTI. I think i'll integrate it into one of our other projects to see what the options are. We looked at it briefly when we realized it was available but never went back to it (we were down a path already).

    Side note - the licensing stuff works REALLY well... so i imagine the obb loader will work.
     
  6. Daniel_Brauer

    Daniel_Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,355
    Hey, I just wanted to let you guys know that we're in exactly the same situation and looking for a solution as well. Don't have one yet, and have tried/thought about all the things you're discussing. The exception is that we haven't tried Floky's tool, which honestly looks like the most promising approach right now.

    Just a quick sanity check: we originally thought that our problem was using Streamed Scene Asset Bundles, because they can only be created compressed. However, I'm not convinced that removing the compression would allow us to use the bundles in-place, given that WWW is designed for remote files as well as local ones. That is, I think it always makes a copy regardless of where the source file is. Am I missing something, or are asset bundles simply not designed to store local, immediately-usable game data?
     
  7. jvil

    jvil

    Joined:
    Jul 13, 2012
    Posts:
    263
    bump!

    I'm in a similar situation. Which solution have you taken guys?
     
  8. jvil

    jvil

    Joined:
    Jul 13, 2012
    Posts:
    263
    I've an OBB file which contains all scenes, and a separate downloader/launcher of this file. My ideas are:

    1. OBB file uncompressed and launch first scene with AssetBundle.CreateFromFile(). This seems the most efficient in terms of speed to load faster the first scene, the problem it's the OBB file is uncompressed so it's a big file.

    2. OBB file compressed and launched when it's downloaded. It's quite slow due to compression.

    3. OBB file compressed, download file and unzip, then load with AssetBundle.CreateFromFile(). The problem is maybe device can run out of memory while decompressing.

    Any idea with a compressed file to improve launching speed?
     
  9. moghazy

    moghazy

    Joined:
    Apr 3, 2011
    Posts:
    64
    how you guys made the obb files ? I only be able to make .unity3d file that has all the scenes
     
  10. Deleted User

    Deleted User

    Guest

    Hey folks, anyone had any joy with the 'official' split APK feature? To date I think this: http://labs.exoa.fr/tutorial-unity-4-apk-splitting-google-play-obb/ is the only resource out there that's of any direct help; it certainly got me up to speed with the frustratingly non-trivial set up for apps >50mb on Google Play.

    However, despite everything working perfectly well with the downloader / OBB split feature, I now have extremely long load times with my app (5mins plus between scenes!). I'm wondering if anyone else has noticed an increase in load times with their own OBB split apps running on device? I can understand this to some extent, if Unity is decompressing data from the OBB at runtime, and / or retrieving data from the OBB via some 'slow due to hardware limitations' sdcard data transfer pipeline - does that sound plausible?
     
    TrashBag likes this.
  11. Arkasis

    Arkasis

    Joined:
    Nov 22, 2010
    Posts:
    61
    Hi everybody, I got the same issue. The OBB file is downloaded correctly, then I try to load another scene and all the game freeze for a long long long long time. The obb size is over 120Mb.
    I try another solution, I use my start scene to download the OBB in order to do not have to load a scene after the download. And then, all the game scene crash when the download is ended.
    I think the OBB is decompressing and it just 80% time crash the application and 20% time launch it after 10-20 min delay...
    PS : I'm using a Galaxy tab.
    If somebody find a solution...
     
  12. eriQue

    eriQue

    Unity Technologies

    Joined:
    May 25, 2010
    Posts:
    595
    To get 'optimal' loading speed from asset bundles you need to create them uncompressed.
    If you use zip as "container" format for the OBBs (n.b. that is not needed if you only have one big asset bundle) and load them with WWW("jar:file://..") make sure that the asset bundle is stored uncompressed inside the zip (otherwise the WWW operation will need to decompress the jar/zip stream).
    If you just store the asset bundle as the OBB then you can just load it with AssetBundle.CreateFromFile().

    Since asset bundles are not ideal for use with OBBs we added the automatic splitting in Unity 4.0 : http://docs.unity3d.com/Documentation/Manual/android-OBBsupport.html.
     
  13. Deleted User

    Deleted User

    Guest

    Hi erique - we are using the officially supported split apk option (no AssetBundles), and this results in extremely long load times. I've tried repackaging the automatically generated OBB in an uncompressed format, bit this results in a massive filesize increase (118MB to 800+MB in my case), and crashes the app when it tries to navigate to the first scene in the OBB. Any ideas?
     
  14. eriQue

    eriQue

    Unity Technologies

    Joined:
    May 25, 2010
    Posts:
    595
    I assume you mean the "split application binary" option that we added in 4.0? (just making sure)

    There is essentially no difference how data is structured and loaded when using the "split application binary" option.
    The only difference in load times that I can see has to come from the sdcard being slower than the internal flash memory.
    Feel free to report a bug if you have some indication that contradicts that.

    You shouldn't do that - there is a high chance you'll make the .obb not match the .apk. Think of the .apk+.obb as a file virtually cut into two pieces - if you start restructuring one of the pieces chances are they don't match what the binaries in the .apk piece expect them to be.

    That is a clear indication that the .apk part cannot load/attach the .obb part (see above) - and since the .obb part is not available you will crash when accessing data from it.
     
  15. Inmersys

    Inmersys

    Joined:
    Oct 28, 2012
    Posts:
    4
    We are having a very similar problem. After downloading the .obb the loading time of the first scene is very long (after that, app runs smoothly, but it is still not friiendly for user experience to wait that much at the start).

    I am assuming this long loading time is caused by the decompression of the .obb. Is there a way to decompress all data and leave it that way even after closing the app?

    Or... is there a way to load the first scene after it is decompressed without having to wait decompression of all scenes?
     
  16. Deleted User

    Deleted User

    Guest

    That's a fantastic answer, thanks erique

    - Yes we're using the U4 'split application binary option'

    - I also have a hunch that it's either A) that SD card access is slow and or B) scene in the OBB needs to be decompressed with each access. The only test device I have available is a Galaxy Tab 2 (not too badly specced); it has no physical SD card inserted, so I'm putting my OBB in the relevant location on the internal 'emulated SD' kind of storage - I'd have thought that would have been fast access?

    - My messing about with the OBB was a last ditch attempt to salvage things; thanks for confirming that is a no-go option!

    My current conclusions: For resource heavy projects, split application binary is probably just simply not going to work... But I don't know why you'd need to split application binary on anything but a resource heavy project!
     
  17. eriQue

    eriQue

    Unity Technologies

    Joined:
    May 25, 2010
    Posts:
    595
    To make things completely transparent - Unity reads compressed data straight from the inside .apk (when the app is not split) and straight from the .obb (when the app is split). There is an on-the-fly decompression while loading going, both when reading from the .apk and when reading from the .obb.
    There is no first-decompress-to-a-temporary-file-then-load. And the loading mechanism is (near) identical when reading from the .obb instead of the .apk (they are both essentially .zip files, so reading the data is done in the same way).
    That's why I'm saying that the load characteristics should be the "same" with split/non-split applications. ("same" except for sdcard being slower or something).

    It's a bit strange that you get such a big difference on a Galaxy Tab since, as you say, the sdcard is emulated on reasonably fast memory.
    Did you try it on any other device? Do you see anything "special" in the logcat and/or the Unity Profiler during these long load times?

    Is there any chance you could report this as a bug, and attach your project?
     
  18. Deleted User

    Deleted User

    Guest

    Once again a great answer, thanks kindly. Unfortunately we don't physically have acces to another device just yet, but that is definitely a necessary part of our investigation - if it turns out to be an issue limited solely to Galax Tab 2 I'll laugh. And then cry a little bit.

    I don't see anything untoward in logcat during the scene load process.

    I'll see if I can submit a bug report - I'd also be interested if anyone else with the same issue spoke out on this forum too, just to get a better handle on the possible scale of things.
     
  19. Deleted User

    Deleted User

    Guest

    After a lot more research at this end (including other Android devices), it's looks like it's our usage of large numbers of audio files set to 'stream from disk' (up to 100 in some cases) that is resulting is really slow scene loading times. This appears to be an issue only in combination with the 'split application binary' feature.

    * Changing the audio setting to 'compressed in memory' presents a much more normal quick load time for scenes built with split binary!

    * Utilising a large number of 'stream from disk' audio *without* split binary would appear to work 'normally', with perfectly tolerable load times.

    eriQue, can you comment as to whether this sounds like A) a bug or B) misguided use of Unity: I know that it's not advised to use so many audio streams, but we needed to work around memory limitations on device. We are ready to submit a test case and bug report if this appears to be a valid problem.
     
    Last edited by a moderator: Jan 3, 2013
  20. eriQue

    eriQue

    Unity Technologies

    Joined:
    May 25, 2010
    Posts:
    595
    I can't comment on the misguided part ;) but, I can't see why it would make a difference in the case of using split binaries.
    I'd recommend you to submit a bug with a test case, and what device you are using, so that our QA can have a look at it.

    Thanks.
     
  21. bpritchard

    bpritchard

    Joined:
    Jan 29, 2009
    Posts:
    444
    So we've moved over to the new and improved obb loader from unity and now i'm simply beating my head against a brick wall. We're currently trying to get it setup using the tutorial located here...

    http://labs.exoa.fr/tutorial-unity-4-apk-splitting-google-play-obb/

    and i'm trying to get the obb to even load directly from disc (w/o the download) and every single time i get an error as follows...

    Buffer allocation failed; Unable to allocate 575641205 bytes download buffer
    (Filename: ./PlatformDependent/AndroidPlayer/AndroidWWW.cpp Line: 200)

    Wth?! That is indeed teh file size... but after that error i then get this message from unity...

    wwww error file:///mnt/sdcard/Android/obb/com.bigfishgames.google.heuifull/main.44.com.bigfishgames.google.heuifull.obb aborted

    apparently the WWW call is not finding the file or aborting for whatever reason. Has anyone run across this before? I am literally using the example from the link verbatim and its just not working.

    Here's my download code...

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class DownloadObbExample : MonoBehaviour
    6. {
    7.     private string expPath;
    8.     private string logtxt;
    9.     private bool alreadyLogged = false;
    10.     private string nextScene = "Main_Menu";
    11.     private bool downloadStarted;
    12.  
    13.     public Texture2D background;
    14.     public GUISkin mySkin;
    15.  
    16.     void log( string t )
    17.     {
    18.         logtxt += t + "\n";
    19.         Debug.Log("MYLOG " + t);
    20.     }
    21.     void OnGUI()
    22.     {
    23.         if(mySkin != null)
    24.             GUI.skin = mySkin;
    25.         GUI.DrawTexture(new Rect(0,0,background.width,background.height),background);
    26.  
    27.         if (!GooglePlayDownloader.RunningOnAndroid())
    28.         {
    29.             GUI.Label(new Rect(10, 10, Screen.width-10, 20), "Use GooglePlayDownloader only on Android device!");
    30.             return;
    31.         }
    32.  
    33.         expPath = GooglePlayDownloader.GetExpansionFilePath();
    34.         if (expPath == null)
    35.         {
    36.             GUI.Label(new Rect(10, 10, Screen.width-10, 20), "External storage is not available!");
    37.         }
    38.         else
    39.         {
    40.             string mainPath = GooglePlayDownloader.GetMainOBBPath(expPath);
    41.             string patchPath = GooglePlayDownloader.GetPatchOBBPath(expPath);
    42.             if( alreadyLogged == false )
    43.             {
    44.                 alreadyLogged = true;
    45.                 Debug.Log( "expPath = "  + expPath );
    46.                 Debug.Log( "Main = "  + mainPath );
    47.                 Debug.Log( "Main = " + mainPath.Substring(expPath.Length));
    48.  
    49.                 if (mainPath != null)
    50.                     StartCoroutine(loadLevel());
    51.  
    52.             }
    53.             //GUI.Label(new Rect(10, 10, Screen.width-10, Screen.height-10), logtxt );
    54.  
    55.             if (mainPath == null)
    56.             {
    57.                 Debug.Log("Main path was null, attempting to download!");
    58.                 GUI.Label(new Rect(Screen.width-600, Screen.height-230, 430, 60), "The game needs to download 200MB of game content. It's recommanded to use WIFI connexion.");
    59.                 if (GUI.Button(new Rect(Screen.width-500, Screen.height-170, 250, 60), "Start Download !"))
    60.                 {
    61.                     GooglePlayDownloader.FetchOBB();
    62.                     StartCoroutine(loadLevel());
    63.                 }
    64.             }
    65.  
    66.         }
    67.  
    68.     }
    69.     protected IEnumerator loadLevel()
    70.     {
    71.         string mainPath;
    72.         do
    73.         {
    74.             yield return new WaitForSeconds(0.5f);
    75.             mainPath = GooglePlayDownloader.GetMainOBBPath(expPath);
    76.             Debug.Log("waiting mainPath "+mainPath);
    77.         }
    78.         while( mainPath == null);
    79.  
    80.         if( downloadStarted == false )
    81.         {
    82.             downloadStarted = true;
    83.  
    84.             string uri = "file://" + mainPath;
    85.             Debug.Log("downloading " + uri);
    86.             WWW www = WWW.LoadFromCacheOrDownload(uri , 0);
    87.             Debug.Log("After WWW call...");
    88.  
    89.             // Wait for download to complete
    90.             yield return www;
    91.  
    92.             if (www.error != null)
    93.             {
    94.                 Debug.Log ("wwww error " + www.error);
    95.             }
    96.             else
    97.             {
    98.                 Debug.Log("Loading the level");
    99.                 Application.LoadLevel(nextScene);
    100.             }
    101.         }
    102.     }
    103.  
    104. }
    105.  
    106.  
    And outside of that we are using the GooglePlay downloader w/no changes to it (the actual plugin side).
    Any help would be greatly appreciated.

    Cheers
    Bryan
     
  22. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    i don't think you need the loadfromcacheordownload, a simple assetbundle.createfromfile should do, correct?
     
  23. bpritchard

    bpritchard

    Joined:
    Jan 29, 2009
    Posts:
    444
    Actually we resolved the issue. LoadfromCache was being called 2x which was causing the memory allocation issues (I imagine because it was already allocated).
     
  24. eriQue

    eriQue

    Unity Technologies

    Joined:
    May 25, 2010
    Posts:
    595
    Hi Bryan - it's not completely clear if you are now using Unity 4, with the automatic apk splitting, or if you are still using Unity 3 and creating your own OBBs from AssetBundles (or similar).

    But the tutorial you link is mishmash of Unity 3 ideas, (incorrectly) mixed with Unity 4 features. The tutorial is simply incorrect.

    If you use Unity 4 (and use the automatic APK splitting), you should never try to load the OBB using AssetBundle.CreateFromFile / WWW.LoadFromCacheOrDownload.
    It's simply not needed - Unity will pickup the OBB once it is available on disk and read from it, as if it was reading from the APK.

    If you use Unity 3 and create an AssetBundle of assets to use as an OBB - then you need to use AssetBundle.CreateFromFile / WWW.LoadFromCacheOrDownload to access those assets.

    The plugin is only there to download the OBB if it is not present on disk when the application starts.
     
  25. eriQue

    eriQue

    Unity Technologies

    Joined:
    May 25, 2010
    Posts:
    595
    Hi, we've identified a scenario where, as you say, streaming audio can cause a load time penalty when using the 'split application binary' option.
    The problem is fixed and the next version of Unity (or rather the next-next, since the release of the next version is imminent) will not have this problem.

    Thanks.
     
  26. tydygunn

    tydygunn

    Joined:
    Aug 9, 2012
    Posts:
    13
  27. MatthewLeeFarmer

    MatthewLeeFarmer

    Joined:
    Jul 31, 2012
    Posts:
    14
    Hey All!

    I have a quick question about this:

    We're in Unity4. We build using the auto apk splitter. We're running it on a Kindle Fire. We're currently using our own downloader to get the file in it's appropriate place (for the Kindle so we can bypass google play downloading). So we're downloading a file from our own server to the following location:

    /mnt/sdcard/Android/obb/com.companyname.titleofgame/main.1.com.companyname.titleofgame.obb​

    And I checked and the file is completely downloading to that location.

    So then, I attempt to "Application.loadLevel(2);" assuming that Unity will auto pick it up. Instead, it says:

    Level 'Main_Menu' (1) couldn't be loaded because it has not been added to the build settings.

    So I restart the App and it works. Is there anything I have to do to get the OBB file to be recognized without restarting the app?

    Thank you,

    Matthew Farmer
    Matt.F@dogbotstudios.com

    EDIT: I forgot to mention, we tried using the LoadFromCacheOrDownload anyways but it crashed. It did find the file (when I mistyped the file, it broke), it sat for a while without progress, then finally crashed.

    EDIT 2: Sorry, last edit. Apparently restarting the app will in fact get it to recognize.
     
    Last edited: May 10, 2013
  28. eriQue

    eriQue

    Unity Technologies

    Joined:
    May 25, 2010
    Posts:
    595
    The OBB is added to the "search path" during a pause/resume cycle of the main activity. Application.dataPath will indicate if it is mounted.
    So you need to trigger that a pause/resume cycle if its not mounted (simplest way would be to init a "dummy" activity that only returns immediately).
     
  29. MatthewLeeFarmer

    MatthewLeeFarmer

    Joined:
    Jul 31, 2012
    Posts:
    14
    This worked! Thank you so much!
     
  30. emongev

    emongev

    Joined:
    Jul 5, 2012
    Posts:
    36
    Im having that exact same issue, anybody found a solution for this?
     
  31. Evola

    Evola

    Joined:
    Feb 22, 2013
    Posts:
    8
    Hello, I'm having another problem.
    I have done, step by step, this tutorial: http://labs.exoa.fr/tutorial-unity-4-apk-splitting-google-play-obb/
    I use Unity 4 with the "split application binary" option and I have uploaded the apk and the obb file to google (the .obb is a massive 800Mb file). I can download the obb from my app but the first scene is never loaded. The app crash after a few seconds.
    I'm lost with this issue, i don't know what to do now. Can anyone help me?
     
  32. parthpatel1612

    parthpatel1612

    Joined:
    May 17, 2013
    Posts:
    15
    we are using Unity 4.0 and we are using auto apk splitter and google obb downloader plugin but we are using our own server to put the .obb file and to download it. Now its downloading at the right place and we are getting that error :
    Level (1) couldn't be loaded because it has not been added to the build settings. And when we force quit the application and restart it, its works fine.
    Now according to your above post, we tried to restart the activity like this:
    using (AndroidJavaClass unity_player = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
    {
    AndroidJavaObject current_activity = unity_player.GetStatic<AndroidJavaObject>("currentActivity");

    AndroidJavaObject intent = current_activity.Call<AndroidJavaObject>("getIntent");
    int Intent_FLAG_ACTIVITY_NO_ANIMATION = 0x10000;
    intent.Call<AndroidJavaObject>("addFlags", Intent_FLAG_ACTIVITY_NO_ANIMATION);

    //current_activity.Call("finish");

    current_activity.Call("startActivity", intent);

    if (AndroidJNI.ExceptionOccurred() != System.IntPtr.Zero)
    {
    Debug.LogError("Exception occurred while attempting to start activity - is the AndroidManifest.xml incorrect?");
    AndroidJNI.ExceptionDescribe();
    AndroidJNI.ExceptionClear();
    }
    }
    And we are still having that same error.
    So can you please tell us what we are doing wrong ?
     
  33. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,910
    Can anyone explain that in English? I have the LoadFromCacheOrDownload way working perfectly, but not the regular Application.LoadLevel. I'd prefer to use the modern way.
     
  34. shinichi88

    shinichi88

    Joined:
    May 4, 2011
    Posts:
    80
    Yes, thanks a lot.. This solve my mystery and confusion on Google Play Store.
    I've notice the apps download with extra content together ("obb file") when user download from store.

    Before this I was wondering why should we put the loadfromcacheordownload script into it.
    The whole app become slower on the first scene.

    Here is my sticky note on my desktop !

    Unity 4.x
    No need to put OBB downloader script scene.
    Unity will automatic refer to Obb file.

    Make sure the OBB file rename as
    main.<ver>.com.Company.ProductName.OBB
    Upload to google play store and DONE!

    For testing purpose,
    put the renamed OBB file in
    sdcard/Android/Obb/com.Company/ProductName folder
    Install the apk and run.
     
  35. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,240
    I'm having trouble getting the Google Play store to download the .obb file. So reading these notes:

    You mean rename the .obb file after Unity publishes it, so the name doesn't match the apk's name? I'll try it, but please elaborate if you can. Thanks!
    Dave
     
  36. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,240
    So I tried this -- using that naming convention for both the apk and the obb, just to be safe -- and it works automagically! No special code in the intro scene is required. Why isn't this documented? But thanks so much for sharing that info!
     
  37. Muckel

    Muckel

    Joined:
    Mar 26, 2009
    Posts:
    471
    Yes but not on older Devices... for that kind of OS Device you need the google obb downloader
     
  38. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,240
    Ah -- but if my app is restricted to Android 4+, do I need to add the OBB downloader stuff?
     
  39. Muckel

    Muckel

    Joined:
    Mar 26, 2009
    Posts:
    471
    gooood question...!

    it's a shame that there is like no info from Unity in the Doc's...
     
  40. tallyho_stu

    tallyho_stu

    Joined:
    May 10, 2010
    Posts:
    38
    Edit: Solved this - it was just an issue with the public not being added correctly to the GooglePlayDownloader.cs


    Hi, I'm also having trouble getting the .obb to download. The files appear to have been uploaded correctly and I've checked the files locally, copying the .obb to the appropriate directory - the app finds the .obb and runs correctly. Currently though, when I run the app the splash screen displays then it changes to an OnGui button saying 'Pause Download' but this closes quickly, being replaced by a window saying the app has stopped.

    I am getting the following from logcat the refers to an invalid key specification - does any one have any idea?

    Thanks for any help - pretty stuck on this.

    E/LicenseChecker(16677): Invalid key specification.
    W/dalvikvm(16677): threadid=1: thread exiting with uncaught exception (group=0x4
    18de898)
    E/AndroidRuntime(16677): FATAL EXCEPTION: main
    E/AndroidRuntime(16677): java.lang.Error: FATAL EXCEPTION [main]
    E/AndroidRuntime(16677): Unity version : 4.3.1f1
    E/AndroidRuntime(16677): Device model : samsung GT-I9505
    E/AndroidRuntime(16677): Device fingerprint: samsung/jfltexx/jflte:4.3/JSS15J/I9
    505XXUEMK9:user/release-keys
    E/AndroidRuntime(16677):
    E/AndroidRuntime(16677): Caused by: java.lang.IllegalArgumentException: java.sec
    urity.spec.InvalidKeySpecException: java.lang.RuntimeException: error:0D07209B:a
    sn1 encoding routines:ASN1_get_object:too long
    E/AndroidRuntime(16677): at com.unity3d.plugin.downloader.c.j.a(Unknown S
    ource)
    E/AndroidRuntime(16677): at com.unity3d.plugin.downloader.c.j.<init>(Unkn
    own Source)
    E/AndroidRuntime(16677): at com.unity3d.plugin.downloader.b.s.run(Unknown
    Source)
    E/AndroidRuntime(16677): at android.os.Handler.handleCallback(Handler.jav
    a:730)
    E/AndroidRuntime(16677): at android.os.Handler.dispatchMessage(Handler.ja
    va:92)
    E/AndroidRuntime(16677): at android.os.Looper.loop(Looper.java:137)
    E/AndroidRuntime(16677): at android.app.ActivityThread.main(ActivityThrea
    d.java:5419)
    E/AndroidRuntime(16677): at java.lang.reflect.Method.invokeNative(Native
    Method)
    E/AndroidRuntime(16677): at java.lang.reflect.Method.invoke(Method.java:5
    25)
    E/AndroidRuntime(16677): at com.android.internal.os.ZygoteInit$MethodAndA
    rgsCaller.run(ZygoteInit.java:1187)
    E/AndroidRuntime(16677): at com.android.internal.os.ZygoteInit.main(Zygot
    eInit.java:1003)
    E/AndroidRuntime(16677): at dalvik.system.NativeStart.main(Native Method)

    E/AndroidRuntime(16677): Caused by: java.security.spec.InvalidKeySpecException:
    java.lang.RuntimeException: error:0D07209B:asn1 encoding routines:ASN1_get_objec
    t:too long
    E/AndroidRuntime(16677): at org.apache.harmony.xnet.provider.jsse.OpenSSL
    Key.getPublicKey(OpenSSLKey.java:89)
    E/AndroidRuntime(16677): at org.apache.harmony.xnet.provider.jsse.OpenSSL
    RSAKeyFactory.engineGeneratePublic(OpenSSLRSAKeyFactory.java:47)
    E/AndroidRuntime(16677): at java.security.KeyFactory.generatePublic(KeyFa
    ctory.java:171)
    E/AndroidRuntime(16677): ... 12 more
    E/AndroidRuntime(16677): Caused by: java.lang.RuntimeException: error:0D07209B:a
    sn1 encoding routines:ASN1_get_object:too long
    E/AndroidRuntime(16677): at org.apache.harmony.xnet.provider.jsse.NativeC
    rypto.d2i_PUBKEY(Native Method)
    E/AndroidRuntime(16677): at org.apache.harmony.xnet.provider.jsse.OpenSSL
    Key.getPublicKey(OpenSSLKey.java:87)
    E/AndroidRuntime(16677): ... 14 more
     
    Last edited: Dec 19, 2013
  41. tallyho_stu

    tallyho_stu

    Joined:
    May 10, 2010
    Posts:
    38
    Edit: Solved this - there was no need for the pause / resume code - I basically needed to upload both apk and obb again - frustrating but at least it's working.

    @parthpatel1612
    Hi, did you have any luck getting this fix to work? I'm having the same issue with the level apparently not being loaded ... the difference I have is that rebooting the app doesn't resolve the issue (as far as showing the app works). I have also noted that the application.dataPath isn't pointing at the .obb but at a different directory holding a pkg.apk (my original apk is named differently).
    Thanks for any help.

    Some more info:

    MainOBBPath is looking for an .obb at: /storage/emulated/0/Android/obb/com.company.appname/main.2.com.company.appname.obb

    When I try testing the two files locally i.e. not downloading the .obb, that’s where I copy the .obb to (after first installing the .apk) .... the app runs fine with this setup.
    Application.dataPath also points here during this test.

    However, when downloading the .obb, although MainOBBPath is still pointing at the same location above (the .obb is downloaded to this location as expected), but Application.dataPath is looking at:
    /mnt/asec/com.company.appname-1/pkg.apk
     
    Last edited: Dec 19, 2013
  42. vvander

    vvander

    Joined:
    Jan 18, 2011
    Posts:
    72
    I'm having the same issues... although for me, re-uploading the apk and obb file to Google Play doesn't work. It also appears to only be a problem for certain devices (Nexus 4, 5, and Galaxy S3 have been identified so far). I've uploaded at least 10 versions and none of them are working. There's a lot of stuff I've tried, including everything listed in this thread (like keeping the main.<version>.com.<company>.<package> naming convention for both the obb and the apk).

    By the way, my Application.dataPath is apparently looking in /data/app/com.<companyname>.<appname>-2.apk

    Can anyone help me out? The game is already on the Play Store and I'm certain it will get negative reviews if we advertise it in this state. As of now, we've had to disable compatibility for the devices we've identified as issues, but those are popular devices and need to be compatible.
     
    Last edited: Feb 6, 2014
  43. Dover8

    Dover8

    Joined:
    Aug 20, 2010
    Posts:
    94
    Hi there,

    I'm struggling to get my head around the whole .obb file too. I've got it split using the build setting and scenes are loading up fine. My issue is that I reference several files in the StreamingAssets folder which no longer seem to be available in the same manner. How do I navigate to files that should be contained within the .obb?
     
  44. _niko

    _niko

    Joined:
    Apr 19, 2014
    Posts:
    2
    Hi there,
    I need to quit(minimize) application during obb downloading, it is publisher requirement. Application should exit by pressing "back" button. I try to use Application.Quit() in downloader scene, but there some black screen still stay on device, this screen disappear after second press on "back" button.
    Also I'am try to use this code to minimize app:
    Code (csharp):
    1.  
    2. void quitApp()
    3.     {
    4.         using (var intentClass = new AndroidJavaClass("android.content.Intent"))
    5.         {  
    6. AndroidJavaObject intentObject = new AndroidJavaObject("android.content.Intent", intentClass.GetStatic<string>("ACTION_MAIN"));
    7.  
    8.             intentObject.Call<AndroidJavaObject>("addCategory", intentClass.GetStatic<string>("CATEGORY_HOME")); //CATEGORY_HOME
    9.             intentObject.Call<AndroidJavaObject>("setFlags", intentClass.GetStatic<int>("FLAG_ACTIVITY_CLEAR_TOP")); //FLAG_ACTIVITY_CLEAR_TOP
    10.  
    11.            
    12.             AndroidJavaClass unity = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
    13.             AndroidJavaObject currentActivity = unity.GetStatic<AndroidJavaObject>("currentActivity");
    14.             currentActivity.Call("startActivity", intentObject);
    15. };
    16. }
    17.  
    but app behaviour still same.

    Can someone prompt the correct way of app minimization?
     
  45. DP_S4y

    DP_S4y

    Joined:
    Jan 24, 2014
    Posts:
    8
    Hi everyone,

    I'm trying to use the auto split application binary from Unity 4, but the generated .apk is larger than 50mb (51mb to be exact). This way I can't publish it to the Google Play Store.

    What are my options? Is it a problem with Unity? I'm using version 4.5.0f6.
     
  46. DP_S4y

    DP_S4y

    Joined:
    Jan 24, 2014
    Posts:
    8
    Found out what was wrong. The apk size is dependent of the first scene the game loads. I just had to make a first scene with only the splash screens and the size was greatly reduced.

    Thanks anyway.
     
  47. Ramsdal

    Ramsdal

    Joined:
    Oct 18, 2013
    Posts:
    251
    http://forum.unity3d.com/threads/he...ogle-play-obb-downloader.239456/#post-1758834

    *Sigh*... the confusion... ??

    Edit: Ohh and sorry for reviving an old thread ;)
     
  48. sevensails

    sevensails

    Joined:
    Aug 22, 2013
    Posts:
    483
    Is there any final word on this?
     
  49. Ramsdal

    Ramsdal

    Joined:
    Oct 18, 2013
    Posts:
    251
    This thread is a huge mess of different input... In my case, I ended up using the OBB plugin on the asset store, and got it working fine with split binery file. Remember to have a small "Load scene" that handles the OBB download. And then after that load your real level. It was actually not that complicated after all, but I do not yet make use of asset bundles - also I have not yet testet on unity5, tough I can see no reason for it to fail :)
     
    Meltdown likes this.
  50. iivo_k

    iivo_k

    Joined:
    Jan 28, 2013
    Posts:
    314
    I'm also getting an InvalidKeySpecException like @tallyho_stu , was there some solution to that?