I am building my Xamarin.Android project and I have selected AOT compilation which has bloated my .apk to 165mb.
To get my .apk size down I am looking at the target architectures, currently I target:
armeabi, armeabi-v7, x86, arm64-v8a
But I have no idea how these architectures correspond to modern devices.
I have read Android CPU Architectures and it says:
Xamarin.Android defaults to armeabi-v7a for Release builds. This
setting provides significantly better performance than armeabi. If you
are targeting a 64-bit ARM platform (such as the Nexus 9), select
arm64-v8a. If you are deploying your app to an x86 device, select x86.
If the target x86 device uses a 64-bit CPU architecture, select
x86_64.
Therefore do I need to target armeabi and armeabi-v7?
what archetectures should I target for a modern Android tablet and phone?
armeabi is for older devices as most newer devices run armeabi-v7. Secondly, 64 bit devices can fallback to other ABIs. If you're concerned about the size, then your best choice is to create multiple apks:
https://developer.xamarin.com/guides/android/application_fundamentals/cpu_architectures/#Targeting_Multiple_Platforms
Although Google recommends a single APK, this is not always the case:
Although we encourage you to develop and publish a single APK that supports as many device configurations as possible, doing so is sometimes not possible. To help you publish your application for as many devices as possible, Google Play allows you to publish multiple APKs under the same application listing. Google Play then supplies each APK to the appropriate devices based on configuration support you've declared in the manifest file of each APK.
https://developer.android.com/google/play/publishing/multiple-apks.html
Related
I have built a game in Unity Android.
I want to upload multiple APKs targeting different CPU architectures in Google Play Developer Console.
Targeting 64 bit CPU architecture is compulsory, we cannot publish apps without targeting 64-bit architecture. I have uploaded APK targeting ARM64 CPU architecture and rolled it out to production successfully.
Now the problem is that I want to add APKs targeting ARMv7 (32-bit) and x86 CPU architectures.
For that, I have:
Created New Release.
Uploaded APK that targets ARMv7 with different Version code.
I have retained previous APK that was targeting ARM64 so that current release will offer 64-bit version for 64-bit devices.
Now when I Proceed to Review I am getting errors
Error
This release is not compliant with the Google Play 64-bit requirement
The following APKs or App Bundles are available to 64-bit devices, but they only have 32-bit native code: 8.
Fully shadowed APK
Problem:
This APK will not be served to any users because it is completely shadowed by one or more APKs with higher version codes.
Here is the Screesnhot:
It is saying that I need to include support for 64-bit architecture. But I have already uploaded APK previously for the same. I cannot upload ARMv7 and x86 versions of the app.
Starting August 1, 2019, your apps published on Google Play will need to support 64-bit architectures. 64-bit CPUs deliver faster, richer experiences for your users. Adding a 64-bit version of your app provides performance improvements, makes way for future innovation, and sets you up for devices with 64-bit-only hardware.
Source: Support 64-bit architectures
If you are using a version of Unity that supports 64-bit Android libraries, you can generate a 64-bit version of your app by adjusting your build settings. You will also need to use the IL2CPP backend as your Scripting Backend (details here). To set up your Unity project to build 64-bit architecture, do the following:
Go to Build Settings and ensure you are building for Android by
verifying that the Unity symbol is next to Android under Platform.
If the Unity symbol is not next to the Android platform, select
Android and click Switch Platform.
Click Player settings.
Player settings in Unity
Navigate to Player Settings Panel > Settings for Android > Other
settings > Configuration
Set Scripting Backend to IL2CPP.
Select the Target Architecture > ARM64 checkbox.
set target architectures in Unity
Build as normal!
You should provide bigger bundle version code for more enchansed apk.
In this case arm64 Version Code must be 8, and arm-v7 Version Code is 7.
This is because the "device" is looking for the first matching APK with the highest Version Code. And since arm64 cpu support arm-v7, then in your case they will all receive the arm-v7 version, since its Version is higher, ie it hides the assembly for arm 64.
I was getting this warning in google play. This release is not compliant with the Google Play 64-bit requirement. The following APKs or App Bundles are available to 64-bit devices, but they only have 32-bit native code
I noticed that my apk had only x86, x86_64, armeabi_v7a folders. So I updated the gradle build script and now I have arm64-v8a folder as well. I see all the .so in armeabi-v7a generated in arm64 too.
How can I validate that this will support 64 bit devices
You can create an emulator with 64 bit image, to see that the app works on it.
Also, in your build variants, you can choose which active abi to use:
We have an app on the Google play store with two version of the APK for different architectures (ARM and x86). This is due to a dependant library being more stable when run natively.
However, a certain x86 based device is failing when running the x86 binary and I would like users of this device to switch to using the ARM version. The options to exclude devices only seems to apply to both APK files together.
Is this possible to configure in the Google Play Developer Console?
The only solution I've found is a hack.
It's possible to add additional contraits to the x86 build as specified here:
https://developer.android.com/google/play/filters.html#other-filters
In our case, we can add a constraint on compatible-screens to the app manifest saying that the x86 build is only supported by the precise screen resolution of the device that works with the build. The problematic x86 devices have a different resolution and are then excluded.
Google's Play Store lets you upload multiple APKs for your app, one for ARM processors and one for x86 processors, so Intel based Android devices can run the app natively. Can I do the same in the Amazon Appstore? I've tried uploading a second binary but it says my x86 APK is not supported by ANYTHING, not only Amazon devices, it also says it won't work with any non-Amazon Android device.
Is that true or is that an incorrect analysis? It doesn't let me submit my application anyway, unless I remove my x86 APK so the only available APK is the ARM one. Is there any way around that so I can submit an app with both an ARM APK and an x86 APK?
Regrettably, no. Amazon Appstore does not support x86 architecture, so it won't be possible to upload 2 binaries of different architecture. Only ARM is supported at the moment.
I have an App containing a native library. The library only works in Android devices containing an ARM cpu.
The native library .so files are stored in the armeabi-v7a folder indicating the .so files are for a ARM cpu.
However when I upload the apk to the Play Store, the App can be downloaded on Android devices containing a x86 (or mips) based cpu. The App crashes as the library does not work on a non ARM cpu.
Unfortunately the library is only available on ARM so I can't include the x86 and mips .so files.
My question is: how can I limit the App from being downloaded by non ARM cpu devices?
I expected some requires=* settings in the AndroidManifest files but I can't find related settings.
Any ideas?
If you switch to advanced mode in the Google Play Developer Console it should give you some options regarding limiting to specific CPU architectures when uploading your APK. Documentation can be found at http://developer.android.com/google/play/publishing/multiple-apks.html .