Search Unity

Addressables errors with Android split binary

Discussion in 'Addressables' started by VoodooDetective, Sep 15, 2021.

  1. VoodooDetective

    VoodooDetective

    Joined:
    Oct 11, 2019
    Posts:
    239
    We're using Unity 2020.3.18f1 and Addressables 1.19.4 (we've also tried 1.18.15)

    Google requires us to split the game up before uploading it to the google play store. We built the game into an .apk and an .obb file and after installing it, the game crashes immediately with Addressables errors.

    Installation Procedure:
    1. Build the game with split binary option checked
    2. adb install game.apk
    3. adb push main.4.studio.shortsleeve.game.obb /sdcard/Android/obb/studio.shortsleeve.game/
    I verify that the obb file is there, then I run the game and get the following errors.


    Code (CSharp):
    1. 09-15 10:50:56.639 27740  2255 E Unity   : RemoteProviderException : TextDataProvider : unable to load from url : jar:file:///data/app/~~689q54a8zSXXloEqeqgmbA==/studio.shortsleeve.voodoodetective-XMFOqP0J2uMakI-c6HOVJQ==/base.apk!/assets/aa/settings.json
    2. 09-15 10:50:56.639 27740  2255 E Unity   : UnityWebRequest result : ProtocolError : HTTP/1.1 404 Not Found
    3. 09-15 10:50:56.639 27740  2255 E Unity   : ResponseCode : 404, Method : GET
    4. 09-15 10:50:56.639 27740  2255 E Unity   : url : jar:file:///data/app/~~689q54a8zSXXloEqeqgmbA==/studio.shortsleeve.voodoodetective-XMFOqP0J2uMakI-c6HOVJQ==/base.apk!/assets/aa/settings.json
    5. 09-15 10:50:56.639 27740  2255 E Unity   :
    6. 09-15 10:50:56.639 27740  2255 E Unity   : System.Action`2:Invoke(T1, T2)
    7. 09-15 10:50:56.639 27740  2255 E Unity   : UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1:set_OperationException(Exception)
    8. 09-15 10:50:56.639 27740  2255 E Unity   : UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1:Complete(TObject, Boolean, Exception, Boolean)
    9. 09-15 10:50:56.639 27740  2255 E Unity   : UnityEngine.ResourceManagement.ResourceProviders.InternalOp:CompleteOperation(String, Exception)
    10. 09-15 10:50:56.639 27740  2255 E Unity   : UnityEngine.ResourceManagement.ResourceProviders.InternalOp:RequestOperation_completed(AsyncOperation)
    11. 09-15 10:50:56.639 27740  2255 E Unity   : System.Action`1:Invoke(T)
    12. 09-15 10:50:56.639 27740  2255 E Unity   : UnityEngine.AsyncOperation:InvokeCompletionEvent()
    13. 09-15 10:50:56.639 27740  2255 E Unity   :
    14. 09-15 10:50:56.640 27740  2255 E Unity   : RuntimeData is null.  Please ensure you have built the correct Player Content.
    15. 09-15 10:50:56.640 27740  2255 E Unity   : UnityEngine.ResourceManagement.AsyncOperations.InitalizationObjectsOperation:Execute()
    16. 09-15 10:50:56.640 27740  2255 E Unity   : UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1:InvokeExecute()
    17. 09-15 10:50:56.640 27740  2255 E Unity   : System.Action`1:Invoke(T)
    18. 09-15 10:50:56.640 27740  2255 E Unity   : UnityEngine.ResourceManagement.AsyncOperations.<>c__DisplayClass57_0:<add_CompletedTypeless>b__0(AsyncOperationHandle`1)
    19. 09-15 10:50:56.640 27740  2255 E Unity   : System.Action`1:Invoke(T)
    20. 09-15 10:50:56.640 27740  2255 E Unity   : DelegateList`1:Invoke(T)
    21. 09-15 10:50:56.640 27740  2255 E Unity   : UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1:InvokeCompletionEvent()
    22. 09-15 10:50:56.640 27740  2255 E Unity   : UnityEngine.ResourceManagement.ResourceManager:ExecuteDeferredCallbacks()
    23. 09-15 10:50:56.640 27740  2255 E Unity   : UnityEngine.ResourceManagement.ResourceManager:Update(Single)
    24. 09-15 10:50:56.640 27740  2255 E Unity   : System.Action`1:Invoke(T)
    25. 09-15 10:50:56.640 27740  2255 E Unity   :
    26. 09-15 10:50:56.641 27740  2255 E Unity   : OperationException : Addressables - Unable to load runtime data at location UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1[[UnityEngine.AddressableAssets.Initialization.ResourceManagerRuntimeData, Unity.Addressables, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]].
    27. 09-15 10:50:56.641 27740  2255 E Unity   : System.Action`2:Invoke(T1, T2)
    28. 09-15 10:50:56.641 27740  2255 E Unity   : UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1:set_OperationException(Exception)
    29. 09-15 10:50:56.641 27740  2255 E Unity   : UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1:Complete(TObject, Boolean, Exception, Boolean)
    30. 09-15 10:50:56.641 27740  2255 E Unity   : UnityEngine.AddressableAssets.Initialization.InitializationOperation:Execute()
    31. 09-15 10:50:56.641 27740  2255 E Unity   : UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1:InvokeExecute()
    32. 09-15 10:50:56.641 27740  2255 E Unity   : System.Action`1:Invoke(T)
    33. 09-15 10:50:56.641 27740  2255 E Unity   : UnityEngine.ResourceManagement.AsyncOperations.<>c__DisplayClass57_0:<add_CompletedTypeless>b__0(AsyncOperationHandle`1)
    34. 09-15 10:50:56.641 27740  2255 E Unity   : System.Action`1:Invoke(T)
    35. 09-15 10:50:56.641 27740  2255 E Unity   : DelegateList`1:Invoke(T)
    36. 09-15 10:50:56.641 27740  2255 E Unity   : UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1:InvokeCompletionEvent()
    37. 09-15 10:50:56.641 27740  2255 E Unity   : UnityEngine.ResourceManag
     
    Last edited: Sep 15, 2021
  2. VoodooDetective

    VoodooDetective

    Joined:
    Oct 11, 2019
    Posts:
    239
    I've just noticed that all called to Resources.Load() seem to be failing to load data.
     
  3. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,822
    I'll kick this to the team for their guidance.
     
    VoodooDetective likes this.
  4. VoodooDetective

    VoodooDetective

    Joined:
    Oct 11, 2019
    Posts:
    239
    Awesome, thanks! We really appreciate any help you can give. We can't sell our game on Google Play until this issue is resolved.
     
  5. pillakirsten

    pillakirsten

    Unity Technologies

    Joined:
    May 22, 2019
    Posts:
    346
    Hi @VoodooDetective if you inspect the APK file (you can add .zip to the file name to view it), does it contain the assets/aa folder? It might be located in the OBB file instead.

    At runtime Addressables will try to load that folder from Application.streamingAssetsPath. Based on your logs, Application.streamingAssetsPath is pointing to the APK.
     
  6. VoodooDetective

    VoodooDetective

    Joined:
    Oct 11, 2019
    Posts:
    239
    @pillakirsten Thanks for your reply!

    I looked in the APK and it does not contain a folder under assets called "aa." I opened the OBB archive, and there is a folder called "aa" there. So you're correct, the addressables and resources and streaming assets are all in the OBB. Which, as I understand it, is expected behavior.

    That said, there's still nothing is loading. If you use the split binary option, addressables stop functioning.

    Please let me know what I need to do to make Split Binary and Addressables work together.
     
  7. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    Does it work if you do "Build and Run" in Unity instead of installing APK + OBB manually? Similarly, have you tried to upload APK + OBB to the Play store's test track and install from the Play store directly?
     
  8. VoodooDetective

    VoodooDetective

    Joined:
    Oct 11, 2019
    Posts:
    239
    Hi @JuliusM!

    Yep, I've tried both of those. They both fail identically.
    Please let me know if there's more information I can provide, this has held up testing for several weeks now. It's become the biggest issue for our company.
     
    Last edited: Sep 27, 2021
  9. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    What devices are affected? Is it reproducible with all of your test devices or just some of them? I've heard about some OBB loading issues on Samsung Galaxy S21 and Pixel 5 devices, but I haven't seen any bug reports yet. Could you submit a bug report, so our QA would try to reproduce it?
     
  10. VoodooDetective

    VoodooDetective

    Joined:
    Oct 11, 2019
    Posts:
    239
    Hi @JuliusM!

    Just another update. I've tried printing out these two variables in a very simple test project:

    Code (CSharp):
    1.         Debug.Log("Streaming Assets Path: " + Application.streamingAssetsPath);
    2.         Debug.Log("Data Path: " + Application.dataPath);
    What it printed out was:

    Code (CSharp):
    1. Streaming Assets Path: jar:file:///data/app/~~nq_9qkqNnWVGAtQIw7mKnA==/com.DefaultCompany.Myproject-Bsioa18RZ8WMDCVfWBlT1g==/base.apk!/assets
    2. Data Path: /data/app/~~nq_9qkqNnWVGAtQIw7mKnA==/com.DefaultCompany.Myproject-Bsioa18RZ8WMDCVfWBlT1g==/base.apk
    Which of course won't work because those resources are located in the OBB file. So either this is a bug in Unity, or Addressables needs to account for the fact that neither of these two variables will update even if the locations they reference have changed to an OBB file. I can share a that reproduction project with you if that's helpful.


    EDIT: I just saw your last message. I'm currently testing on a Samsung Galaxy S21 Ultra.
     
  11. pillakirsten

    pillakirsten

    Unity Technologies

    Joined:
    May 22, 2019
    Posts:
    346
    Hi @VoodooDetective if you haven't already, please do submit a bug report with the reproduction project. We'll take a look at it.
     
    VoodooDetective likes this.
  12. VoodooDetective

    VoodooDetective

    Joined:
    Oct 11, 2019
    Posts:
    239
  13. pillakirsten

    pillakirsten

    Unity Technologies

    Joined:
    May 22, 2019
    Posts:
    346
    Perfect thank you!
     
    VoodooDetective likes this.