我已经按照以下步骤进行密钥库配置:
https://facebook.github.io/react-native/docs/signed-apk-android.html
当我尝试在小米Mi5s(Android 6.0)设备中安装APK文件时,它会出现“App not installed”错误。调试模式没有问题。
应用程序在运行时也会立即崩溃:
react-native run-android --variant=release
build.gradle
档案:
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 enableProguardInReleaseBuilds = false
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.company.app"
minSdkVersion 16
targetSdkVersion 22
versionCode 300000
versionName "3.0.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
manifestPlaceholders = [manifestApplicationId: "${applicationId}",
onesignal_app_id: "341c3f97-4e33-49b5-91c6-d79f3e1ad372",
onesignal_google_project_number: "438620944422"]
}
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 false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
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]
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
}
}
}
}
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
// These docs use an open ended version so that our plugin
// can be updated quickly in response to Android tooling updates
// We recommend changing it to the latest version from our changelog:
// https://docs.fabric.io/android/changelog.html#fabric-gradle-plugin
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile project(':react-native-fabric')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
compile project(':react-native-i18n')
compile project(':react-native-contacts')
compile project(':react-native-onesignal')
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
答案 0 :(得分:0)
在安装发行版apk之前,您需要卸载该应用的所有其他版本。请确保没有为其他用户安装该应用程序(我们也遇到了Nexus 5的问题)。要为所有用户卸载应用程序,只需打开应用程序设置,然后为所有用户选择卸载,而不是仅将其拖动。
答案 1 :(得分:0)
我对这个问题的解决方案是(Xiaomi Mi5s):
现在我可以安装APK的发布版本。