javaandroidgoogle-play64-bitandroid-architecture

how to make project 64 bit compatible


Recent changes in android architecture have enforced all developers to make their android applications support 64bit.

I have gone through the documentations. But as it shows there to look for a "lib" folder that may supposedly have ".so" files.

I tried the same thing, but apparently I can't find and "lib" folder to begin with, my app is completely written in java, there is no native(C,C++) code.

Can anyone suggest me what can be done or how can I ensure my apps are 64bit supported or how I will get the lib with .so files.


Solution

  • Short answer:

    If you have no native (NDK) code, that is you only write Java/Dex code, then you don't need to do anything.

    If you have native code (or libraries) then you need to supply their 64-bit versions.


    Detailed answer (explanation):

    Following action is suggested by the Google Play team:

    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.

    Summarising the documentation link that is provided in the above quoted paragraph:

    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....

    If your APK already has NDK code and 64-bit libraries, follow this:

    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'
    
    // 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'   
    // ...
    

    I hope this helps.