2

In my react-native project, in android gradle file I have the following configuration-

apply plugin: "com.android.application"

import com.android.build.OutputFile



project.ext.react = [
        entryFile: "index.js"
]

apply from: "../../node_modules/react-native/react.gradle"

def enableSeparateBuildPerCPUArchitecture = false


def enableProguardInReleaseBuilds = false

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion

    defaultConfig {
        applicationId "XXXX"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode XXX
        versionName "XXX"

        ndk {
            abiFilters "armeabi-v7a", "x86"
        }

        packagingOptions {
            exclude "lib/arm64-v8a/librealm-jni.so"
        }


    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }
    signingConfigs {
        release {
            if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
                storeFile file(MYAPP_RELEASE_STORE_FILE)
                storePassword MYAPP_RELEASE_STORE_PASSWORD
                keyAlias MYAPP_RELEASE_KEY_ALIAS
                keyPassword MYAPP_RELEASE_KEY_PASSWORD
            }
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.release

        }
    }


    applicationVariants.all { variant ->
        variant.outputs.each { output ->


            def versionCodes = ["armeabi-v7a":1, "x86":2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}

dependencies {
    implementation(project(':react-native-firebase')){
        exclude group: 'com.google.android.gms'
    }

    implementation(project(':react-native-maps')){
        exclude group: 'com.google.android.gms', module: 'play-services-base'
        exclude group: 'com.google.android.gms', module: 'play-services-maps'
    }

    //implementation project(':react-native-firebase')
    implementation project(':react-native-vector-icons')
    implementation project(':react-native-svg')

    implementation 'com.google.android.gms:play-services-base:16.1.0'
    implementation 'com.google.android.gms:play-services-basement:16.2.0'
    implementation 'com.google.android.gms:play-services-maps:16.0.0'

    implementation "com.google.firebase:firebase-core:16.0.6"
    implementation "com.google.firebase:firebase-messaging:17.3.4"



    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    implementation "com.facebook.react:react-native:+"  // From node_modules

    implementation 'me.leolin:ShortcutBadger:1.1.21@aar'
    implementation project(':react-native-splash-screen')
}


apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"


task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

apply plugin: 'com.google.gms.google-services'

After building the apk I have tested in both 32 bit and 64 bit devices, it works well but after submitting the released apk to play store it is showing the following error-

enter image description here

I have tried many solutions and including the below changes-

How to Include 64-bit and 32-bit native code in my app

I have also tried the following solution-

64 bit version issue in react-native android app by google play store

But my react-native upgrade to 0.59 didn't happen.

None of them worked for me. So, I need a perfect solution to build an apk which will both in 32 & 64 bit and it not show any error while uploading to play store.

S. M. Asif
  • 3,437
  • 10
  • 34
  • 58
  • 5
    Possible duplicate of [64 bit version issue in react-native android app by google play store](https://stackoverflow.com/questions/48732351/64-bit-version-issue-in-react-native-android-app-by-google-play-store) – azundo Sep 10 '19 at 06:20

1 Answers1

1

add "arm64-v8a", "x86_64"

in splits.abi.include like

    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
        }
    }

source

Vinil Prabhu
  • 1,279
  • 1
  • 10
  • 22