Limit Android apk download to ARM devices - android

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 .

Related

How to make APK compliant with Google Play 64-bit Requirement?

I know this question has been asked before, but I am still struggling to find a functioning answer on how to properly achieve this. When I upload our APK to the Google Play dev console, I get the following warning:
Our application uses three jniLibs that fall into the following architectures: arm4-v8a, armeabi-v7a, and x86. Clicking the Learn More link attached to the error gives the following solution to this problem:
However, adding this ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86' in my default config in my build.gradle stills gives the same error referenced above. I am kind of lost on this as I am following what Google recommends and would appreciate any help on the matter.
Here's some additional information:
APK Analyzer Results
I am building a signed APK using the V2 (Full APK Signature).
Removing the x86 jniLib allows me to upload the APK to the Google Play store with zero errors, however, then I am unable to run the Android Emulator because the AVDs only support x86.
An optimal solution would either be: Upload the to the playstore with the x86 support without encountering any errors or upload to the Playstore without the x86 library and still be able to run the emulator within Android Studio. Any ideas?
I'd see two whole other options there ...
A) You'd have to exclude that Epson native assembly for x86 from the release build... because when x86 is present, it will also demand x86_64. I'd assume it is there for x86 emulation, but for debug builds this isn't the problem. Removing it and using a slow ARM emulator might not be the answer. Try adding this into buildTypes.release (in order to keep it for debugging purposes):
packagingOptions {
exclude "lib/x86/*.so"
}
B) Seiko Epson would meanwhile offer native assembly for x86_64 ...if you'd update their SDK.
Technically speaking, option A would be a whole lot better, because of a smaller package size.
Google Play Console states that if you support a 32-bit architecture, you must also support the corresponding 64-bit version.
I see two options:
Provide the x86_64 versions of your libs.
Remove the x86 version of your libs and use an arm architecture AVD system image, which are available.

Android: how to test for 64-bit device compatability

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:

How do I know what target Architectures to choose?

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

Googleplay don‘t filter x86 device

I generated a .so file which is builded by using ndk-build command. And in the Application.mk file,i writed these: APP_ABI := armeabi. Then, I used this .so file in another app, but I figured it out that the app is visible in Google play with an x86 device.
From the docs (http://developer.android.com/google/play/filters.html): By including native libraries built with the Android NDK that target a specific CPU architecture (ARM EABI v7 or x86, for example).
Now I'm confused, what should i do to make my app invisible to x86 device in GooglePlay?
We have an application published in GooglePlay,the application will crash in x86 device. So we want to make the application invisible for x86 device in GooglePlay. Now we have our .so file in armeabi directory under jniLibs directory, but x86 device still can find the application in GooglePlay.
Google Play may be depending on the fact that x86 has a translation layer which will take armeabi code and translate to x86. See: How does native android code written for ARM run on x86?
While I don't know why your particular app won't work on x86, one way to handle it is to check the CPU/Architecture when you app starts up via the old
Build.CPU_ABI
or on API 21 and up
Build.SUPPORTED_ABI
http://developer.android.com/reference/android/os/Build.html#CPU_ABI
and prevent the user from running your app if a condition isn't met like CPU architecture. So on launch you would check and if the device isn't correct degrade with a dialog and/or prevent the user from accessing the feature which would crash.
EDIT
If you are required to block devices from even seeing your app, you'll have to use the Google Play Developer console to select what devices can see your app.
See: How to restrict android app to specific device make?
and https://support.google.com/googleplay/android-developer/answer/1286017?hl=en
Of course as new x86 devices come online you'll have to remove them as well.

Can APKs compiled for x86 be uploaded to the Amazon Appstore?

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.

Categories

Resources