chaquo / chaquopy

Chaquopy: the Python SDK for Android
https://chaquo.com/chaquopy/
MIT License
807 stars 132 forks source link

Chaquopy bundles seemingly unneeded native assets #1080

Closed IsakTheHacker closed 8 months ago

IsakTheHacker commented 8 months ago

I have configured my project to build separate APKs for every architecture, however when examining an arm64 APK it seems like Chaquopy has bundled some assets for all architectures. image Why are the selected files bundled? Are they safe to remove using packagingOptions in build.gradle?

mhsmith commented 8 months ago

I have configured my project to build separate APKs for every architecture,

How exactly have you done this? Please post the relevant sections of your build.gradle file.

mhsmith commented 8 months ago

If this is still a problem, please post the requested information, and I'll reopen the issue.

IsakTheHacker commented 7 months ago

I'm sorry for creating issues and then not following up with more information. I think something is wrong about my abi split configuration and maybe it is also related to the other issue with the target abi warnings. When I have time to take a proper look, I will of course post all the configuration. But as a temporary fix, would it be safe to remove the selected bundled assets manually from the final APK if it is just supporting the arm64-v8a ABI, as described above?

mhsmith commented 7 months ago

It would be safe from Chaquopy's point of view, but I don't know if it would invalidate the APK's signature.

The recommended way to build separate APKs for each ABI is described in the FAQ.

IsakTheHacker commented 7 months ago

Thank you, that workaround will work just fine for now. I'm excluding the assets based on the method I mentioned in the first message so signatures shouldn't be an issue I think.

And yes, I am indeed using the recommended strategy for building separate APKs for each ABI (since it says in the manual that AABs don't automatically split the ABIs properly?). However, I have chaquopy in a separate library module so the ABI split configuration is specified there and in the app module if that makes sense.

mhsmith commented 7 months ago

Yes, the FAQ method probably won't work if you're using a library module, because it'll put all the ABIs in the library, and then has no way of knowing which ones to remove in the app itself. As far as the Android Gradle plugin knows, there's no such thing as an ABI-specific asset, only an ABI-specific lib directory.