javascript - 如何制作发布apk?
问题描述
我有项目。调试版本有效。但不释放。
我有 wix-react-native-navigation、react-native-svg 和 react-native-vector-icons 的项目。调试版本运行良好,但运行后发布版本显示此错误。 https://pp.userapi.com/c845016/v845016142/19d693/rHQyJ1_rgy4.jpg
这是我的 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 enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.mobilessu"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
ndk {
abiFilters "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
}
}
}
lintOptions{
abortOnError false
}
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
}
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:25.0.1"
implementation "com.facebook.react:react-native:+" // From node_modules
implementation project(':react-native-navigation')
implementation project(':react-native-svg')
implementation project(':react-native-vector-icons')
}
// 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'
}
解决方案
我发现我的错误。在 build.gradle 中必须是:
project.ext.react = [
bundleAssetName: "index.android.bundle",
entryFile: "index.android.js",
bundleInRelease: true
]
推荐阅读
- tensorflow - PyInstaller 是否包含 CUDA
- checkbox - 在分页 vue-bootstrap 中保持复选框状态
- javascript - 为什么我的样式组件没有按照使用 GatsbyJS 的指定呈现?
- python - 我有这个错误:raise Teminator turtle.Terminator
- r - 将 lapply() 中的 .SD 列名与数据表一起使用
- sql - 如何对两个查询的大小应用算术运算
- c - C中的Realloc函数
- angular - 将输入数组数据从 ionic 3 中的 ngModel 传递给 http
- c++ - 具有对象的右值引用的线程
- c# - 使用正则表达式匹配带有某些字母的单词