I need to detect at runtime if an app is an APK or an AAB. If it’s not an AAB, then it throws an error if I try to access asset packs.
I see that there’s an enum at Unity.Android.Types.AndroidApplicationType that specifies between apk and aab, but I don’t see any methods that return that type, and searching Unity’s docs for that type turns up nothing.
AAB is just an install package, when you do build & run with aab, the apk is extracted from aab, and apk is installed on the device.
The same happens when you install application from Google Play Console, even if you upload aab, the apk extracted from aab will be installed on the device.
My primary issue is getting that play core error if I try to access asset packs without an AAB and I was hoping I could access Unity.Android.Types.AndroidApplicationType somewhere to fix it. Do you have any suggestions for getting around that error on apk builds?
I think you can always check if you have access to java class like - com.google.android.play.core.assetpacks.AssetPackManagerFactory (using Unity - Scripting API: AndroidJavaClass), if you can’t access it, that means asset pack logic cannot work, and the build was produced without asset pack support
Might be due to PAD package is being added to the gradle dependencies only when building AAB? Not an expert, but wouldn’t including these dependencies manually solve the issue?