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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Bug LoadContentCatalogAsync fails with null exception on Android, despite address being accessible

Discussion in 'Addressables' started by CanisLupus, Jul 22, 2020.

  1. CanisLupus

    CanisLupus

    Joined:
    Jul 29, 2013
    Posts:
    427
    We use this code to load a remote catalog:
    Code (CSharp):
    1.         try {
    2.             AsyncOperationHandle<IResourceLocator> operation = Addressables.LoadContentCatalogAsync(url);
    3.             await operation.Task;
    4.             Debug.Log("State of loading Addressables remote catalog: " + operation.Status);
    5.         } catch (System.Exception e) {
    6.             Debug.LogWarning("LoadContentCatalogAsync failed with exception:\n\n" + e);
    7.         }
    It works fine on Windows. However, when it runs on Android, it crashes with this exception:
    We confirmed that the URL for the catalog is accessible and it opens correctly in an Android browser, so this seems like a bug...?

    The crash happens here, in InitalizationObjectsOperation.cs due to the result of the operation (rtd) being null:

    upload_2020-7-22_12-4-32.png

    The operation seems to be started from here, in InitializationOperation.cs:

    upload_2020-7-22_12-5-38.png

    Any ideas?

    This is using Unity 2019.4.1f1 and Addressables 1.10.

    We have our Addressables in a separate project, so that we can keep using the same Unity version and keep retro-compatibility with the app, even if users use an older version. Is this a problem in any way? It means that there are no Addressable groups in the app project itself. Again, Windows builds work fine with the same code.

    Thanks!
     
  2. CanisLupus

    CanisLupus

    Joined:
    Jul 29, 2013
    Posts:
    427
    Seems like it's fixed in either version 1.11 or 1.12. I had to forcefully work around the bugs/breaking changes in those versions to reach this conclusion.
     
  3. zhouhong

    zhouhong

    Joined:
    Jul 5, 2017
    Posts:
    5
    Hi CanisLupus, how you work around it? I have the same issue. my code here:
    Code (CSharp):
    1.         AsyncOperationHandle<IResourceLocator> loadContentCatalogAsync = Addressables.LoadContentCatalogAsync(
    2.          @catalogPath);
    3.         loadContentCatalogAsync.Completed += OnCompleted;
    4.     }
    5.     private void OnCompleted(AsyncOperationHandle<IResourceLocator> obj)
    6.     {
    7.         IResourceLocator resourceLocator = obj.Result;
    8.         Debug.Log(obj.Status);
    9.         if (obj.Status.ToString() == "Succeeded")
    10.         {
    11.             InitAndWaitUntilLocLoaded();
    12.         }
    13.         else
    14.         {
    15.             canvas.transform.Find("ErrorMsg").GetComponent<Text>().text = "File not found in " + catalogPath;
    16.         }
    17.  
    18.  
    I can get the Status "Succeeded" in Unity Editor, but get "Failed" when run from Android phone
     
  4. CanisLupus

    CanisLupus

    Joined:
    Jul 29, 2013
    Posts:
    427
    Hi @zhouhong, what I meant was that the problem I originally had was fixed in version 1.11 or 1.12, but those versions had other problems at the time, around which I had to work before being able to confirm that they fixed it.

    I don't know about your specific case but the problem shouldn't happen in current versions! Well, unless there was a regression. NOTE: I haven't used Addressables in a while.