How to build a 64-bit only apk package, excluding 32-bit
Related
I have a question with flutter build aar command line and target platform.
flutter build aar has a option --target-platform
When using flutter build aar --target-platform android-arm64, It seems to build an aar targeting arm64.
I checked the docs.
Apps built for ARMv7 or ARM64 run fine (using ARM emulation) on many x86 Android devices.
https://docs.flutter.dev/resources/faq#what-devices-and-os-versions-does-flutter-run-on
Looking at the above document, it is stated that the app built with arm64 run fine on many x86 Android devices.
Does this mean that Android host App embeded aar built with flutter build aar --target-platform android-arm64 will run fine on x86 Android devices?
I am trying to build a release app with low file size in Flutter. Yesterday the release apk size was around 16mb, but after I updated the flutter, the size goes to 23mb.
After some researching, I fount out that flutter generates app bundle with all of the ABIs in it and after the update, new API has been added to apk.
After adding app to android studio apk analyzer, I can see the different ABIs in them as below:
x86_64 7.1mb
arm64-v8a 7mb
armeabi-v7a 6.8mb
I can use flutter build apk --split-per-abi to generate apks for different ABIs.
Now the question is, can a arm64-v8a system run x86_64 apk? (or the otherwise).
Or can any of these ABI apk releases, be run in all the devices?
I don't release my app on app stores, I just put it on my clients website and their clients will download it from there (or it will be sent to them by email, ... ). So I need one release that works in all of the android devices and the full bundle release is way too large (23mb).
EDIT:
I just tested x86_64 build on a arm64-v8a device and it did not install. but the armeabi-v7a version did install.
I did some research and tried the release versions on different devices and this is the result:
The command is : flutter build apk --split-per-abi
The x86_64 apk version does not work on any other devices. I could not find an x86_64 device but I assume it will work on x86_64 devices!
The arm64-v8a apk version gets installed on arm64-v8a but it will not install on armeabi-v7a devices. (armeabi-v7a is older than
arm64-v8a).
armeabi-v7a apk version works on armeabi-v7a and arm64-v8a devices. I did not find an x86_64 device but I think it will work on this
device too.
Summary: The newer version of the ABI can run the older apk builds. The order is: armeabi-v7a then arm64-v8a then x86_64.
For example, armeabi-v7a will install and work on all of the devices and if you build and arm64-v8a apk, it will NOT install on armeabi-v7a devices.
There are other architectures that are no longer used (mips, mips64, armeabi) and Flutter by default, will not contain them in builds.
the X86 and X86_64 architectures are for very limited number of devices, but may be useful for debugging in the emulator.
This was the result of my researches and testings. I decided to only use the armeabi-v7a so the apk size will be 8mb instead of 23mb.
If someone else having this question/trouble, I hope this helps :).
Write this command on the cli of your vscode or android studio to build a 3 version of your flutter android project:
flutter build apk --target-platform android-arm,android-arm64,android-x64
https://flutter.dev/docs/deployment/android
https://cloud.tencent.com/developer/article/1661684
I have Unity project with DLL prepared for architectures: x86, x86_64, armeabi-v7a.
I haven no possibility to convert DLL to architecture arm64-v8a.
However if I build apk for armeabi-v7a only, it works on 64bit device.
But for Google Store I need to build it with arm64-v8a compatibility - this version of application doesn't work because there is error that 64 bit DLL not found.
Is there any possibility to solve this problem?
Maybe there is some possibility to modify apk file after build?
Thanks in advance for help.
I installed Qt 5.11.2(http://download.qt.io/official_releases/qt/5.11/5.11.2/qt-opensource-windows-x86-5.11.2.exe) to build an Android app. Qt creator auto-detects 3 Qt versions:
Qt 5.11.2 for Android ARMv7,
Qt 5.11.2 for Android x86,
Qt 5.11.2 MinGW 32bit.
I think they are all 32 bit.
But when I created a project, in the "select Kits" step, it says "Android has not been configured. Create Android kits.". When I clicked the "configure" button, in Device/Android, it says "Cannot create kits for all architectures. Qt versions are missing for the following architectures: arm-linux-android-elf-64bit, x86-linux-android-elf-64bit. To add the Qt version,select Options > Build&Run > Qt Versions". But I do not want to build the 64 bit app. I just want to build the 32bit app using the existing Qt versions. How to bypass this error and build a 32bit Android app? I wonder why it refers to the 64 bit architectures, just because the 32 bit qt is installed on 64 bit machine?
I am new to android. And i don't know how to get the info about android apps.
Can anyone please suggest that how one can find that the android app running is 32bit or 64 bit?
Thanks
APKs are not 32-bit or 64-bit. NDK binaries (.so files) inside of APKs will be compiled for specific CPU architectures. Generally, 32-bit binaries should work fine on 64-bit CPUs.
APK is ZIP. You can open it and check directory lib to see which architectures are supported. If there is no directory lib, it supports all architectures.
https://developer.android.com/ndk/guides/abis.html