How to Make Android Apps Which Support Both 32-Bit and 64-Bit Architecture

How to make Android apps which support both 32-bit and 64-bit architecture?

According to an official email sent by the Google Play Team, the action required is:

If you haven't yet, we encourage you to begin work for the 64-bit
requirement as soon as possible. Many apps are written entirely in
non-native code (e.g. the Java programming language or Kotlin) and
will not need code changes.

Please note that we are not making changes to our policy on 32-bit
support. Google Play will continue to deliver apps with 32-bit native
code to 32-bit devices. The requirement means that those apps will
need to have a 64-bit version as well.

To help you make the transition, we've prepared documentation on how
to check whether your app already supports 64-bit and how to become
64-bit compliant.

We're also providing a high-level timeline below.

So, the linked documentation explains:

If your app uses only code written in the Java programming language or
Kotlin, including any libraries or SDKs, your app is already ready for
64-bit devices. If your app uses any native code, or you are unsure if
it does, you will need to assess your app and take action.

[...]

The simplest way to check for 64-bit libraries is to inspect the
structure of your APK file. When built, the APK will be packaged with
any native libraries needed by the app. Native libraries are stored in
various folders based on the ABI. It is not required to support every
64-bit architecture, but for each native 32-bit architecture you
support you must include the corresponding 64-bit architecture.

For the ARM architecture, the 32-bit libraries are located in
armeabi-v7a. The 64-bit equivalent is arm64-v8a.

For the x86 architecture, look for x86 for 32-bit and x86_64 for
64-bit.

The first thing to do is ensure that you have native libraries in both
of these folders.[...]

And, to build 64-bit libraries, you basically need to follow the instructions below:

Most Android Studio projects use Gradle as the underlying build
system, so this section applies to both cases. Enabling builds for
your native code is as simple as adding the arm64-v8a and/or x86_64,
depending on the architecture(s) you wish to support, to the
ndk.abiFilters setting in your app's 'build.gradle' file:

// Your app's build.gradle
apply plugin: 'com.android.app'

android {
compileSdkVersion 27
defaultConfig {
appId "com.google.example.64bit"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
ndk.abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
// ...

Finally, a quick note:

The 64-bit version of your app should offer the same quality and
feature set as the 32-bit version.

By the way, this official video talks a little bit about it.

How to ensure an application will be compliant with 64 bit?

To clarify, the 64-bit requirement is only for projects which besides Java also use native binaries, and by native binaries it means c/c++ compiled .so files.
The requirement specifies that besides 32-bit binaries, the developer must include also the 64-bit variants. This can be done in 2 ways, as usual with a single APK containing both binary types (32-bit & 64-bit .so files), or splitting it into 2 APK flavors.

Either way, if you have developed your project using only Java then you don’t need to worry, unless you have dependencies on third-party libraries which use native binaries on their own. In such scenario you must ensure that any of your project dependencies also include the 64-bit native variants.

In your case, if you can't find any *.so file in your APK then there is no further action you need to take, everything is good to go.

APKs or App Bundles are available to 64-bit devices but they only have 32-bit native code

For future reference:

It's an issue with google play and x86 build that do not offers a 64bit counterpart code. Disabling x86 build fix this issue.

Reference: https://forum.unity.com/threads/successful-unity-aab-build-not-compliant-with-the-google-play-64-bit-requirement.729035/

The problem started on 08/20/2019.

How to make the GluonMobile-based app compatible with the new Google 64-bit architecture policy?

The jfxmobile plugin has just been updated to provide support for 64 bits libraries, you will need to upgrade your projects to use version 1.3.17.

Alternatively, if you want to keep an older version of the plugin you can do:

jfxmobile {
javafxportsVersion = '8.60.12'
...
}

But if you create a new project with the Gluon plugin for your IDE, now you will get:

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.3.17'
}
}
...

Then if you run ./gradlew android or ./gradlew androidInstall, you will get your apk with a lib folder like:

lib
|-- arm64-v8a
|-- armeabi-v7a

so support for 32 bits and 64 bits is granted now.

Note that having two sets of libraries will increase the size of the apk in 2.5 MB.



Related Topics



Leave a reply



Submit