当我在真实设备上启动应用程序时,该应用程序崩溃(停止工作),出现在初始屏幕之前。我发布了所有架构APK,然后在我的设备中测试了所有APK,但没有一个起作用。我正在使用Hermes,Expo库(我已经为unimodules设置了),并且在弹出项目之前,我已经在Expo应用程序中进行了测试,一切正常!
我的环境:
System:
OS: Windows 8.1 6.3.9600
CPU: (4) x64 Intel(R) Pentium(R) CPU G4560 @ 3.50GHz
Memory: 4.70 GB / 7.96 GB
Binaries:
Node: 12.14.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.21.1 - ~\AppData\Roaming\npm\yarn.CMD
npm: 6.13.4 - C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK:
API Levels: 27, 28
Build Tools: 27.0.3, 28.0.3
Android NDK: Not Found
IDEs:
Android Studio: Not Found
Languages:
Java: 1.8.0_231
Python: 2.7.17
npmPackages:
@react-native-community/cli: Not Found
react: ~16.11.0 => 16.11.0
react-native: ~0.62.2 => 0.62.2
npmGlobalPackages:
*react-native*: Not Found
package.JSON :
{
"scripts": {
"start": "react-native start",
"android": "react-native run-android",
"ios": "react-native run-ios",
"web": "expo start --web",
"postinstall": "jetify"
},
"dependencies": {
"expo": "~38.0.8",
"expo-splash-screen": "^0.5.0",
"expo-status-bar": "^1.0.2",
"expo-updates": "~0.2.10",
"react": "~16.11.0",
"react-dom": "~16.11.0",
"react-native": "~0.62.2",
"react-native-gesture-handler": "1.6.1",
"react-native-reanimated": "1.8.0",
"react-native-screens": "2.7.0",
"react-native-unimodules": "~0.10.1",
"react-native-web": "~0.11.7",
"@react-native-community/masked-view": "0.1.10",
"@react-native-community/netinfo": "5.9.0",
"@react-native-community/viewpager": "^4.1.4",
"expo-camera": "^8.3.1",
"expo-document-picker": "^8.3.0",
"expo-file-system": "^9.1.0",
"expo-image-manipulator": "^8.2.1",
"expo-image-picker": "^8.4.0",
"expo-intent-launcher": "^8.2.1",
"expo-permissions": "^9.1.0",
"firebase": "^7.17.2",
"react-native-animatable": "^1.3.3",
"react-native-material-ripple": "^0.9.1",
"react-native-modal": "^11.5.6",
"react-native-paper": "^4.0.1",
"react-native-progress-circle": "^2.1.0",
"react-native-safe-area-context": "1.0.2",
"react-native-vector-icons": "^7.0.0",
"react-navigation": "4.2.2",
"react-navigation-drawer": "^2.5.0",
"react-navigation-stack": "^2.8.2",
"react-navigation-tabs": "^2.9.0",
"react-redux": "^7.2.1",
"redux": "^4.0.5"
},
"devDependencies": {
"@babel/core": "^7.8.6",
"babel-jest": "~25.2.6",
"jest": "~25.2.6",
"react-test-renderer": "~16.11.0",
"babel-preset-expo": "~8.1.0"
},
"private": true
}
build.gradle(android / app):
apply plugin: "com.android.application"
import com.android.build.OutputFile
project.ext.react = [
enableHermes: true
]
apply from: '../../node_modules/react-native-unimodules/gradle.groovy'
apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/expo-updates/scripts/create-manifest-android.gradle"
def enableSeparateBuildPerCPUArchitecture = true
def enableProguardInReleaseBuilds = false
def jscFlavor = 'org.webkit:android-jsc:+'
def enableHermes = project.ext.react.get("enableHermes", true);
android {
compileSdkVersion rootProject.ext.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.bookep"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk true // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}
signingConfigs {
debug {
storeFile file('my-release-key.keystore')
storePassword '******'
keyAlias 'my-key-alias'
keyPassword '*****'
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
signingConfig signingConfigs.debug
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
packagingOptions {
pickFirst "lib/armeabi-v7a/libc++_shared.so"
pickFirst "lib/arm64-v8a/libc++_shared.so"
pickFirst "lib/x86/libc++_shared.so"
pickFirst "lib/x86_64/libc++_shared.so"
}
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// https://developer.android.com/studio/build/configure-apk-splits.html
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
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
}
}
}
dexOptions {
javaMaxHeapSize "3g"
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:'com.facebook.fbjni'
}
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
}
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
}
addUnimodulesDependencies()
if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
}
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
答案 0 :(得分:0)
我已经使用registerRootComponent
文件中的 Expo 中的index.js
解决了此问题。