Search Unity

Unable to open archive file Android asset bundle

Discussion in 'Asset Bundles' started by WorkinBrandon, Sep 25, 2018.

  1. WorkinBrandon

    WorkinBrandon

    Joined:
    Feb 9, 2016
    Posts:
    2
    Hi there, I'm attempting to load a local asset bundle on Android and running in to the issue that the app is unable to open the archive file asset bundle.

    Building asset bundles for editor and running in editor works fine. Editor version is Unity v2017.4.9f1.

    I am using AssetBundle.LoadFromFile(), including the Application.streamingAssetsPath. I am also definitely building the asset bundles for the Android platform :)

    Code (CSharp):
    1. private bool LoadAssetBundle () {
    2. #if UNITY_EDITOR
    3.             string aBundlePath = Path.Combine("Assets/AssetBundles", spinePrefabAssetPath);
    4. #else
    5.             string truckAssetBundlePathPrefix = Path.Combine(Application.streamingAssetsPath,"AssetBundles");
    6.             string aBundlePath = Path.Combine(truckAssetBundlePathPrefix, spinePrefabAssetPath);
    7. #endif
    8.             AssetBundle aBundle;
    9.             try {
    10.                 aBundle = AssetBundle.LoadFromFile(aBundlePath);
    11.             } catch (System.Exception e) {
    12.                 Debug.LogException(e);
    13.                 return false;
    14.             }
    15.             assetBundle = aBundle;
    16.             return true;
    17.         }
    I am met with this error when logcatting the Android build:

    Unable to open archive file: jar:file:///data/app/com.app/base.apk!/assets/AssetBundles/trucks/Truck1


    I am building the asset bundles for Android device using build asset bundle options None.

    Any help would be appreciated! I am trying to avoid using WWW to open jar, as I know that LoadFromFile() should be able to do the job.
     
    Last edited: Sep 25, 2018
  2. WorkinBrandon

    WorkinBrandon

    Joined:
    Feb 9, 2016
    Posts:
    2
    Fixed! Turns out that in editor, asset bundle location and name is not case sensitive while on device it is.