CreateFromFile does not work on Android-Devices

Hey there,

we currently use the AssetBundle.CreateFromFile-Command to load uncompressed AssetBundles at runtime in our app.
In the editor and on iOS-Devices everything is working fine, but on Android-Devices the app freezes at this point with the error-message: Failed to open file at path: jar:file:///mnt/asec/aBundleIdentifier/pkg.apk!/assets/Android/CharacterElements/characterElementDatabase.assetbundle

I dont know what the problem is. We load other (compressed) AssetBundles via www-requests from that exactly path and everything is working as expected. Do we have to use a special path (url) for the CreateFromFile-Method or is it simply not possible to use this command because the file is not accessible on Android-Devices?

I did not found anything via the search-function, so i am hoping that anyone had similar problems or knows a solution, has a suggestion. Any help is appreciated.

Best

Chris

I’ve got the same problem, can anyone give an advice?

When AssetBundle.CreateFromFile() is called, the Asset Bundle file is kept opened. If many Asset Bundles are opened the app will exceed the maximum number of opened files, and that method will return null. Calling AssetBundle.Unload will close the file.

So you should load all the objects from the bundle (i.e. using assetBundle.LoadAll), or just the ones that you need, and then immediately use AssetBundle.Unload(false) to keep them and close the file.

Maybe the assetbundle is inside the “apk”,the “CreateFromFile()” api is FileSystem path based,not URL that you used.
WWW.assetBundle will work fine.