Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Selected architectures for Android .apk #2873

Closed
itlancer opened this issue Oct 11, 2023 · 2 comments
Closed

[Feature Request] Selected architectures for Android .apk #2873

itlancer opened this issue Oct 11, 2023 · 2 comments
Labels

Comments

@itlancer
Copy link

Feature Description

AIR should support to specify architectures that will be included to .apk build.
If you distribute Android application with private stores or EMM/MDM systems - then in most cases you should provide APK, not AAB. And if you need to support multiple architectures you should provide APK with multiple architectures. But sometimes including "all" four architectures redundantly and cause APK extra file size that should be avoided.

Right now you can just specify only one architecture for APK or "all": https://airsdk.dev/docs/building/air-developer-tool/commands/package#-arch
But there is no option to build just armv7+armv8 APK, for example.

May be it could be implemented via ADT -package -arch comma separated values support (armv7,armv8 for example).
Or <buildArchitectures>armv7,armv8</buildArchitectures> support in application manifest for APK https://airsdk.dev/docs/building/application-descriptor-files/elements/android#buildarchitectures. Right now it works only for AAB, not APK.

Related issue: #2009

Known Workarounds

  1. How to build an APK that supports multiple architectures #2009 (comment)
    Build with -target android-studio, modify build.gradle (Module: application-name.app) (which is actually just in the project folder, subfolder "app", filename "build.gradle").
    by adding something a 'ndk'/'splits' sections:
android {
    some stuff...
    defaultConfig {
      other stuff...
      ndk {
            abiFilters "armeabi-v7a", "arm64-v8a"
        }
    }
    compileOptions {
        more stuff...
    }
    splits {
        abi {
            enable true
            reset()
            include "armeabi-v7a", "arm64-v8a"
            universalApk true
        }
    }
}
dependencies {
...

and build project (APK) via Android Studio.
2) #2009 (comment)
Build AAB with selected architectures and then convert it to APK.

@itlancer
Copy link
Author

itlancer commented Nov 6, 2023

@ajwfrost
Now it possible using AIR SDK 50.2.3.7 and specify, for example,
<buildArchitectures>armv7,armv8</buildArchitectures>
in application XML. Thank you!
But if you AIR application for Android using native extension with native code (.so files) for all platforms (armv7, armv8, x86, x86_64) then in output .APK file all such .so files will be included. Not just armv7 and armv8.
I mean that .APK will have:

MyApp.apk/lib/arm64-v8a/libMyNativeExtension.so
MyApp.apk/lib/armeabi-v7a/libMyNativeExtension.so
MyApp.apk/lib/x86/libMyNativeExtension.so
MyApp.apk/lib/x86_64/libMyNativeExtension.so

not just

MyApp.apk/lib/arm64-v8a/libMyNativeExtension.so
MyApp.apk/lib/armeabi-v7a/libMyNativeExtension.so

@itlancer
Copy link
Author

itlancer commented Nov 8, 2023

Fixed with latest AIR SDK 50.2.3.8.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant