React-Native Release APK崩溃

时间:2019-02-21 14:48:07

标签: android react-native react-native-android

我有一个使用react-native命令运行的react-native run-android应用程序,但是当我尝试构建签名的APK进行发布时,该应用程序在某些设备上崩溃。这是我的构建gradle:

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

defaultConfig {
    applicationId "com.mednetinternal"
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode 1
    versionName "1.0"
    ndk {
      abiFilters "armeabi", "armeabi-v7a", "x86", "arm64-v8a"
    }
}

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

splits {
    abi {
        reset()
        enable enableSeparateBuildPerCPUArchitecture
        universalApk true  // If true, also generate a universal APK
        include "armeabi-v7a", "x86", "arm64-v8a"
    }
}
buildTypes {
    release {
        minifyEnabled enableProguardInReleaseBuilds
        proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        signingConfig signingConfigs.release
    }
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
    variant.outputs.each { output ->
        // For each separate APK per architecture, set a unique version code as described here:
        // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
        def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a":3]
        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
        }
    }
}

我尝试了其他字符串与提到的相同或相似问题相关的方法,但是没有任何效果。提取通用apk后,我发现libimagepipeline.so/lib/arm64-v8a中的唯一文件,但是在PackagingOptions中为其添加一个exclude语句也不起作用。有什么方法可以使apk在所有设备上都能正常工作?

我得到的错误是:

  1. libgnustl_shared.so是32位而不是64位。
  2. 找不到libreactnativejni.so

0 个答案:

没有答案