5
votes

Most of the android developers must have got the message from Google to update the apps to support 64-bit architecture by Aug 2019. The detailed instructions are given here: Ensure that your app supports 64-bit devices

In my app, I found that the 32-bit libs are used and therefore I have to update the app to support 64-bit architecture. As suggested in the guide above, I added the following in build.gradle file:

ndk.abiFilters = 'armeabi-v7a' 'arm64-v8a' 'x86' 'x86_64'

However, after that, I get following error in building the app:

Error:(35, 0) Could not find method armeabi-v7a() for arguments [arm64-v8a] on DefaultConfig_Decorated{name=main, dimension=null, minSdkVersion=DefaultApiVersion{mApiLevel=16, mCodename='null'}, targetSdkVersion=DefaultApiVersion{mApiLevel=28, mCodename='null'}, renderscriptTargetApi=null, renderscriptSupportModeEnabled=null, renderscriptSupportModeBlasEnabled=null, renderscriptNdkModeEnabled=null, versionCode=3, versionName=1.2, applicationId=, testApplicationId=null, testInstrumentationRunner=null, testInstrumentationRunnerArguments={}, testHandleProfiling=null, testFunctionalTest=null, signingConfig=null, resConfig=null, mBuildConfigFields={}, mResValues={}, mProguardFiles=[], mConsumerProguardFiles=[], mManifestPlaceholders={}, mWearAppUnbundled=null} of type com.android.build.gradle.internal.dsl.DefaultConfig.

Has anybody already tried updating the app to 64-bit? Any idea, how to fix this issue?

2
I think it should be ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'. Not sure why they used an equals sign and spaces instead of commas on the developer page.Michael
@Michael you are right. It worked. Incorrect documentation by Google!user846316
Well that's embarrassing. Just sent a commit to fix the docs, so that should at least be fixed soon. Don't hesitate to file bugs when you find mistakes like this. They're easy to fix as long as we know about them.Dan Albert
They have fixed the documentation.user846316

2 Answers

6
votes

It can be done by updating the build gradle defaultConfig

defaultConfig {
    applicationId "my.test.64bitapp"
    minSdkVersion 15
    targetSdkVersion 26
    versionCode 42
    versionName "1.0.2"
    multiDexEnabled true
    vectorDrawables.useSupportLibrary = true
    ndk.abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86' ,'x86_64'
}

or

defaultConfig {
    applicationId "com.swypmedia"
    minSdkVersion 16
    targetSdkVersion 26
    versionCode 2
    versionName "2.0.2"
    ndk {
        abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86' ,'x86_64'
    }
}

I have tested this on android-native and react-native app. build was successful and app was working.

1
votes

According to NdkOptions, abiFilters is defined as Set<String>

Set<String> abiFilters

In groovy, Set is initialised using below syntax (if you want to use the operator '='):

Set<String> mySet = ["armeabi-v7a", "arm64-v8a", "x86", "x86_64"]