Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

[SOLVED] Loading localization (Addressables) fails in Android

Discussion in 'Localization Tools' started by jra8908, Feb 17, 2020.

  1. jra8908

    jra8908

    Joined:
    Apr 1, 2018
    Posts:
    7
    I'm probably missing something trivial but been bashing my head against this now for a while and can't seem to solve it. Using the Localization package and adding translations works perfectly in the Editor, but when I build it for Android I get the error below. Been looking through the documentation for the latest version and I did find that you need to build the Addressables, but I can't seem to find that in my version of Unity (2019.3.1f1).

    Anyone have a clue?


    EDIT: Solution:


    For future reference, more exactly what worked was:

    Window -> Asset Management -> Addressables -> Groups -> Build -> New Build -> Default Build Script (Then build and run on Android)





    02/17 22:59:18.891 10419 10442 Warn Unity: 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]].
    02/17 22:59:18.891 10419 10442 Warn Unity: (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
    02/17 22:59:18.891 10419 10442 Warn Unity:
    02/17 22:59:18.891 10419 10442 Error Unity: Exception encountered in operation UnityEngine.AddressableAssets.Initialization.InitializationOperation, result='', status='Failed': 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]].
    02/17 22:59:18.891 10419 10442 Error Unity: (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
    02/17 22:59:18.891 10419 10442 Error Unity:
    02/17 22:59:18.908 10419 10442 Error Unity: Exception encountered in operation UnityEngine.ResourceManagement.ResourceManager+CompletedOperation`1[System.Collections.Generic.IList`1[UnityEngine.Localization.Locale]], result='', status='Failed': Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=Locale, Type=UnityEngine.Localization.Locale
    02/17 22:59:18.908 10419 10442 Error Unity: (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
    02/17 22:59:18.908 10419 10442 Error Unity:
    02/17 22:59:19.432 10419 10442 Error Unity: Exception encountered in operation UnityEngine.AddressableAssets.Initialization.InitializationOperation, result='', status='Failed' - Chain<IList`1>: ChainOperation of Type: System.Collections.Generic.IList`1[UnityEngine.Localization.Locale] failed because dependent operation failed
    02/17 22:59:19.432 10419 10442 Error Unity: Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=Locale, Type=UnityEngine.Localization.Locale
    02/17 22:59:19.432 10419 10442 Error Unity: (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
    02/17 22:59:19.432 10419 10442 Error Unity:
    02/17 22:59:19.445 10419 10442 Error Unity: Can not preload when `LocalizationSettings.SelectedLocale` is null.
    02/17 22:59:19.445 10419 10442 Error Unity: (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
    02/17 22:59:19.445 10419 10442 Error Unity:
    02/17 22:59:19.446 10419 10442 Error Unity: Can not preload when `LocalizationSettings.SelectedLocale` is null.
    02/17 22:59:19.446 10419 10442 Error Unity: (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
    02/17 22:59:19.446 10419 10442 Error Unity:

     
    Last edited: Feb 18, 2020
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,845
    Hi.
    Did you build the Addressables? You need to open the Addressables window,.under Windows/Asset Management and select Build.
     
    Mobazy, dagobot and Xriuk like this.
  3. jra8908

    jra8908

    Joined:
    Apr 1, 2018
    Posts:
    7
    Thanks for your reply :)

    There is unfortunately no "Build" in my menu that I can find.
    See attached picture.
     

    Attached Files:

  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,845
    Choose the group's option. You will then have a window with build at the top
     
  5. jra8908

    jra8908

    Joined:
    Apr 1, 2018
    Posts:
    7
    First of all, thank you so much, that did the trick :)

    For future reference, more exactly what worked was:

    Window -> Asset Management -> Addressables -> Groups -> Build -> New Build -> Default Build Script (Then build and run on Android)
     
  6. svprdga

    svprdga

    Joined:
    Aug 21, 2012
    Posts:
    14
    Thanks @jra8908 for the precise explanation, that saved a lot of time...
     
  7. Phuggo

    Phuggo

    Joined:
    Jun 22, 2013
    Posts:
    4
    Hi everyone,

    first of all thank you for the nice solution :)

    Does this also work for UWP Devices, for example HoloLens? I did the same procedure and built the adressables, but it doesn't work on the HoloLens device for me.


    Error Exception encountered in operation UnityEngine.AddressableAssets.Initialization.InitializationOperation, result='', status='Succeeded' - Chain<IList`1>: ChainOperation of Type: System.Collections.Generic.IList`1[UnityEngine.Localization.Locale] failed because dependent operation failed
    Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=Locale, Type=UnityEngine.Localization.Locale
    System.Action`1:Invoke(T)
    DelegateList`1:Invoke(T)
    System.Action`1:Invoke(T)
    MonoBehaviourCallbackHooks:Update()
     
    Last edited: Jul 7, 2020
  8. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,845
    It should work for UWP. Did you build the Addressables?
     
  9. Phuggo

    Phuggo

    Joined:
    Jun 22, 2013
    Posts:
    4
    Hi Karl,

    thx for your reply. I got it running now! :) The adressable assets could not be built properly. I had to delete the localization asset and create a new one, then the adressable assets could be built properly again.

    Also, I disabled the code stripping via link.xml:

    <linker>
    <assembly fullname="UnityEngine.Localization" preserve="all"/>
    </linker>
     
    greyhawk97, DhiaSendi and karl_jones like this.
  10. bagieta

    bagieta

    Joined:
    Mar 24, 2017
    Posts:
    5
    Hello. I have the same problem but only with the IL2CPP compiler. When compiling with Mono I got all localization elements (sound clips in this case) available on my android. After switching to IL2CPP it stops working. I tried everything already. Building addressable groups again. Disabling code stripping. link.xml file in Assets. Only my label translations work, but, all audio clips are not available. However, In an editor or when compiled with Mono all is back to normal.
     
  11. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,845
    Do you get any errors?
     
  12. bagieta

    bagieta

    Joined:
    Mar 24, 2017
    Posts:
    5
    unfortunately not. that is the problem.
    probably i will have to implement my own localization package.
    i have tried all solutions i have found on internet...and nothing helped.
    already few days on this...and lost any hope:)
     
  13. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,845
    Ok. Could you file a bug report so we can look into why it was not working?
     
  14. Schodemeiss

    Schodemeiss

    Joined:
    Jan 4, 2018
    Posts:
    43
    [Update] So, the trick of "Bundle Naming - Append Hash to Filename" (from https://forum.unity.com/threads/troubleshooting-addressables-issues.1060346/) fixed this for me. Weird that wasn't already set though? Is that a bug?

    I've got the same issue as above. In the editor my strings all work fine, but in a build - no cigar.

    I've definitely built the addressables, and they've got the Locale tag set. But in a build, I get the following, even if I the flag in my shortcut "-language=en-GB" (en-GB is a locale).

    No Locale could be selected:
    No Locales were available. Did you build the Addressables?
     
    Last edited: Mar 18, 2021
  15. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,845
  16. Schodemeiss

    Schodemeiss

    Joined:
    Jan 4, 2018
    Posts:
    43
    Cool. Is there a fix on the way? And do you happen to know if it's possible to move the AddressableAssetsData folder to somewhere that's not the root of the project? I'm currently using 1.16.16, which seems to have an issue with me moving it somewhere else :-(
     
  17. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,845
    Yes it will be fixed in a future version.
    You can change the path in the Addressables settings. Its in the Addressables Group window under Profile/Manage Profile

    https://docs.unity3d.com/Packages/c...les.html#specifying-packing-and-loading-paths
    Screen Shot 2021-03-18 at 19.34.29.png
     
  18. Schodemeiss

    Schodemeiss

    Joined:
    Jan 4, 2018
    Posts:
    43
    Am I right in thinking that only changes where the assets are built when hitting "Build", rather than where the Addressable Groups gets its data from? I just want to move the actual AddressableAssetsData folder somewhere else in my project. When I do this I find either Builds no longer work, I can't add new addressables, or if I try and use the Localization tools, they fail and say there isn't an AddressablesGroup for them.
     
    Last edited: Mar 19, 2021
  19. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,845
    You should be able to move them. There was a bug where if they were not in the default location it would recreate it so its possible you have this issue. Can you file a bug report?
     
  20. Schodemeiss

    Schodemeiss

    Joined:
    Jan 4, 2018
    Posts:
    43
    That sounds very much like the bug I have. I'll file a report. Thanks for the Localization tips / fixes.
     
    karl_jones likes this.
  21. adbro

    adbro

    Joined:
    Jul 4, 2018
    Posts:
    2
    Thank you so much!! it works
     
  22. mahmoud93p

    mahmoud93p

    Joined:
    Feb 11, 2015
    Posts:
    64
    And this way work with me in windows 10 > thank you
     
    karl_jones likes this.
  23. Dahka

    Dahka

    Joined:
    May 4, 2015
    Posts:
    4
    This also worked for me but I have a further question, how many times will I have to build the addressables? Every time I change something in a string table? Every time I create a new string table? Every time I want to make a build for android? I can't help but feel this dependency on addressables for the localization hinders it more than helps it
     
  24. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,845
    Every time you change a String Table or create a new one. You can set up the build system to just build it each time you do a build if you want to.
     
  25. Dahka

    Dahka

    Joined:
    May 4, 2015
    Posts:
    4
    Thank you again for your very quick reply, I will look into setting up the build system appropriately
     
    karl_jones likes this.
  26. Magnesium

    Magnesium

    Joined:
    Sep 14, 2014
    Posts:
    178
    Hi,

    Sorry for hijacking the topic. I ended up here having the same problem, and i'm wandering how you get the auto-build of assets when building the topic. I've read on another topic that it requires Unity version 2021, i'm still running version 2020. But the weird thing is that i've been using the localization package for a few months and only ran recently in the issue of the build not being able to load localization settings.
     
  27. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,845
    The localization settings are not part of addressables and should always be in the build. Locales, String Tables, Asset Tables, and localized assets are stored in Addressables.
    There is some tips on building via script here https://docs.unity3d.com/Packages/com.unity.addressables@1.19/manual/BuildPlayerContent.html
     
  28. Magnesium

    Magnesium

    Joined:
    Sep 14, 2014
    Posts:
    178
    Yes, of course, i misspoke, i meant of course the tables etc. Thanks for the link.
     
    karl_jones likes this.
  29. Noor23

    Noor23

    Joined:
    Feb 19, 2022
    Posts:
    28
    Hello so I am using azure blob as my cloud to host my addressable items in there now when I hit play using existing build it works and loads my item buttons with their corresponding sprites in unity , but when I build and open it in the android phone non of these items load , Could you please tell me what's the problem and why is this happening???! as I don't think there is something wrong with the code + I have done all the settings for android build ...
     
  30. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,845
  31. Noor23

    Noor23

    Joined:
    Feb 19, 2022
    Posts:
    28
    Thank you for the reply , I fixed it :))) , well now my problem is that 1st when the plane is detected I get them over and over again like crazy I dont know why they keep spawning 2nd is that when I click on one of my items they spawn but if i click another item it spawns too and some kinda float I dont know why ,, cuz I have made in the code so that when I click on the item it spawns if there isnt any and if theres it wont spawn but not sure why it doesnt work upload_2022-5-3_16-40-19.png
     
  32. Noor23

    Noor23

    Joined:
    Feb 19, 2022
    Posts:
    28
  33. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,845
    Noor23 likes this.