我的项目在调试模式下工作正常,但在发布模式下,它在Android的初始屏幕显示后崩溃,而我尚未在ios上构建它。 在React Native的0.57.0版本中它崩溃了,现在我将其降级到0.55.4版本,该版本在我的其他项目之一中可以正常工作
我已经尝试过
这是我的package.json文件
{ "name": "projectName",
"version": "1.0.1",
"private": true,
"rnpm": {
"assets": [
"./src/assets/Fonts/Fonts"
]
},
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.3.1",
"react-native": "0.55.4",
"react-native-countdown-circle": "^3.0.0",
"react-native-event-listeners": "^1.0.3",
"react-native-keyboard-spacer": "^0.4.1",
"react-native-linear-gradient": "^2.4.2",
"react-native-modal": "^6.5.0",
"react-native-percentage-circle": "^1.0.7",
"react-native-sliding-panes": "^1.0.3",
"react-native-snap-carousel": "^3.7.5",
"react-native-splash-screen": "^3.1.1",
"react-native-stars": "^1.1.5",
"react-native-toast": "^1.0.1",
"react-native-vector-icons": "^6.0.2",
"react-navigation": "^2.17.0",
"react-swipeable-views-native": "^0.12.9"
},
"devDependencies": {
"babel-jest": "23.4.0",
"babel-preset-react-native": "2.1.0",
"jest": "23.4.1",
"react-test-renderer": "16.3.1"
},
"jest": {
"preset": "react-native"
}
}
这是我的Android / build.gradle文件
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
google()
}
}
这是我的Android / App / 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 26
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "projName"
minSdkVersion 20
targetSdkVersion 26
versionCode 1
versionName "1.0.1"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
signingConfigs {
release {
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.all { variant ->
variant.outputs.each { output ->
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) {
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:26.1.0"
implementation "com.facebook.react:react-native:+" // From node_modules
implementation project(':react-native-toast')
implementation project(':react-native-splash-screen')
implementation project(':react-native-linear-gradient')
implementation project(':react-native-vector-icons')
}
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
这是我通过运行adb logcat *:S ReactNative:V ReactNativeJS:V
得到的--------系统开始 ---------主要开始10-24 12:43:04.376 3411 3411 D ReactNative:ReactInstanceManager.ctor()10-24 12:43:04.466 3411 3411 D ReactNative: ReactInstanceManager.createReactContextInBackground()10-24 12:43:04.466 3411 3411 D ReactNative: ReactInstanceManager.recreateReactContextInBackgroundInner()10-24 12:44:52.606 3411 3411 D ReactNative: ReactInstanceManager.onJSBundleLoadedFromServer()10-24 12:44:52.606 3411 3411 D ReactNative: ReactInstanceManager.recreateReactContextInBackground()10-24 12:44:52.606 3411 3411 D ReactNative: ReactInstanceManager.runCreateReactContextOnNewThread()10-24 12:44:52.692 3411 3473 D ReactNative: ReactInstanceManager.createReactContext()10-24 12:44:53.020 3411 3473 D ReactNative:初始化React Xplat Bridge。 10-24 12:44:53.025 3411 3473 D ReactNative:初始化React Xplat 初始化之前的桥桥10-24 12:44:53.066 3411 3473 D ReactNative:在initializeBridge之后初始化React Xplat Bridge 10-24 12:44:53.067 3411 3473 D ReactNative: CatalystInstanceImpl.runJSBundle()10-24 12:44:53.067 3411 3477 D ReactNative:ReactInstanceManager.setupReactContext()10-24 12:44:53.068 3411 3477 D ReactNative: CatalystInstanceImpl.initialize()10-24 12:44:53.070 3411 3477 D ReactNative:ReactInstanceManager.attachRootViewToInstance()10-24 12:44:54.244 3411 3476 I ReactNativeJS:运行应用程序“ goHard” 使用appParams:{“ rootTag”:1}。 DEV ===真,开发级别 警告打开,性能优化关闭10-24 12:44:54.981 3411 3476 W ReactNativeJS:警告:isMounted(...)已弃用 普通的JavaScript React类。相反,请确保清理 订阅和componentWillUnmount中的待处理请求以防止 内存泄漏。 10-24 12:45:39.086 3411 3476 I ReactNativeJS:1 10-24 12:45:47.124 3411 3476 W ReactNativeJS:警告:isMounted(...)是 在普通的JavaScript React类中已弃用。相反,请确保 清理componentWillUnmount中的订阅和未决请求 防止内存泄漏。 10-24 12:45:54.050 3411 3476 I ReactNativeJS: 开始加载10-24 12:46:05.064 3411 3476 W ReactNativeJS: 警告:纯JavaScript React中不推荐使用isMounted(...) 类。相反,请确保清理订阅和待处理 componentWillUnmount中的请求,以防止内存泄漏。 10-24 12:46:05.252 3411 3476 W ReactNativeJS:警告:isMounted(...)是 在普通的JavaScript React类中已弃用。相反,请确保 清理componentWillUnmount中的订阅和未决请求 防止内存泄漏。 10-24 12:46:26.850 3411 3476 W ReactNativeJS: 警告:纯JavaScript React中不推荐使用isMounted(...) 类。相反,请确保清理订阅和待处理 componentWillUnmount中的请求,以防止内存泄漏。 10-24 12:46:31.782 3411 3476 I ReactNativeJS:加载开始10-24 12:46:39.773 3411 3476 W ReactNativeJS:警告:isMounted(...)是 在普通的JavaScript React类中已弃用。相反,请确保 清理componentWillUnmount中的订阅和未决请求 防止内存泄漏。 10-24 12:53:39.697 3411 3476 W ReactNativeJS: 警告:纯JavaScript React中不推荐使用isMounted(...) 类。相反,请确保清理订阅和待处理 componentWillUnmount中的请求,以防止内存泄漏。 10-24 12:55:59.792 3870 3870 D ReactNative:ReactInstanceManager.ctor() 10-24 12:55:59.805 3870 3870 D ReactNative: ReactInstanceManager.createReactContextInBackground()10-24 12:55:59.805 3870 3870 D ReactNative: ReactInstanceManager.recreateReactContextInBackgroundInner()10-24 12:55:59.805 3870 3870 D ReactNative: ReactInstanceManager.recreateReactContextInBackgroundFromBundleLoader() 10-24 12:55:59.805 3870 3870 D ReactNative: ReactInstanceManager.recreateReactContextInBackground()10-24 12:55:59.805 3870 3870 D ReactNative: ReactInstanceManager.runCreateReactContextOnNewThread()10-24 12:55:59.855 3870 3885 D ReactNative: ReactInstanceManager.createReactContext()10-24 12:56:00.192 3870 3885 D ReactNative:初始化React Xplat Bridge。 10-24 12:56:00.198 3870 3885 D ReactNative:初始化React Xplat 初始化之前的桥桥10-24 12:56:00.217 3870 3885 D ReactNative:在initializeBridge之后初始化React Xplat Bridge 10-24 12:56:00.218 3870 3885 D ReactNative: CatalystInstanceImpl.runJSBundle() ---------崩溃开始10-24 13:20:48.743 4074 4074 D ReactNative:ReactInstanceManager.ctor()10-24 13:20:48.754 4074 4074 D ReactNative: ReactInstanceManager.createReactContextInBackground()10-24 13:20:48.754 4074 4074 D ReactNative: ReactInstanceManager.recreateReactContextInBackgroundInner()10-24 13:20:48.754 4074 4074 D ReactNative: ReactInstanceManager.recreateReactContextInBackgroundFromBundleLoader() 10-24 13:20:48.754 4074 4074 D ReactNative: ReactInstanceManager.recreateReactContextInBackground()10-24 13:20:48.754 4074 4074 D ReactNative: ReactInstanceManager.runCreateReactContextOnNewThread()10-24 13:20:48.792 4074 4089 D ReactNative: ReactInstanceManager.createReactContext()10-24 13:20:49.048 4074 4089 D ReactNative:初始化React Xplat Bridge。 10-24 13:20:49.052 4074 4089 D ReactNative:初始化React Xplat 初始化之前的桥桥10-24 13:20:49.095 4074 4089 D ReactNative:在initializeBridge之后初始化React Xplat Bridge 10-24 13:20:49.096 4074 4089 D ReactNative: CatalystInstanceImpl.runJSBundle()