简体   繁体   中英

Diagnosing failure to load from OBB file / split APK expansion file android build (in Unity)

I am trying to run an Android project in excess of 100 megabytes.

It works fine when I build a simple oversized APK file, but that's not legal for the Play store.

So I am Exporting it from Unity with the 'Split Application Binary' box ticked, then importing it into Android Studio, then building the APK file there (due to gradle version issues in Unity).

When I install and run it, I am able to detect the existence of the OBB file (using the GooglePlayDownloader.GetMainOBBPath sample code) but when I try to load any of the files that should be in it (using, for example, UnityEngine.Resources.Load), it returns NULL.

I have made a mini project to test OBB files, using the same basic build process, and it works there. I don't know what the difference is. (The real project is far larger and contains a lot of Unity plugins, which I've been testing on the mini project to see if any of them break it - so far, no luck. I have custom gradle and AndroidManifest files to make these plugins work together, which they do in non-split tests.)

Is it possible from Unity code to look at the OBB file and see what's in there, or otherwise confirm the integrity/compatibility of the file, or get a more useful error message from the Android Studio Logcat window?

Note that I'm not currently looking for help downloading OBB files - it seems to work - at least in my mini-project - when I copy in the OBB file as a main.(bundle version code).(package name).obb into the Android/Obb/(package name) subdirectory.

Update: Apparently you can see the contents of an OBB file just be renaming it to a .ZIP file or similar.

My specific problem seems to be that the "unity.build-id" in my AndroidManifest.xml file did not match the name of the 0K file in the Assets folder in the OBB file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM