Googleplay don‘t filter x86 device - android

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.

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.

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

Supported Build.CPU_ABI vs Build.CPU_ABI2 vs Build.SUPPORTED_ABIS

Referring to this document , I understand that if one or more from the Build.CPU_ABI and Build.CPU_ABI2 is equal to the architecture a specific APK is targets to - then running this apk on this specific device should work.
In practice, what happened when I did an experiment confused me:
I took an Azus device running android 4.4 and check the properties it returns:
Build.CPU_ABI = X86
Build.CPU_ABI2 = armeabi-v7a
But in practice, seems like this device is not supporting armeabi-v7a.
I know this because I tried to install on this device a version of Facebook which targets armeabi-v7a , and it fails with a log indicating that ABI not supported.
Also I verified this using adb dump badging on the apk, and it returns:
'native-code': 'armeabi-v7a'
My Questions:
How can it be that device declaring CPU_ABI2 = armeabi-v7a that not really able to run Facebook version targets armeabi-v7a?
It is super important to me understand what exactly going on, since I'm developing an app that exactly like google play suppose to deliver and install to the device applications, and I try to find out what device property will give me indication about the APK I suppose to deliver based on it.

Limit Android apk download to ARM devices

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 .

entry in AndroidManifest that would limit app to ARMv7 devices only?

Is there a setting I can manually put into my AndroidManifest.XML that would limit the devices on which the app can be installed to ARMv7 architecture only?
When you upload an app to Google Play, if you are using the NDK and only include an armeabi-v7a binary, it will be visible to devices with the ARMv7 arch.

Categories

Resources