android - 在 RN 版本 60.4 中加载依赖图后应用程序崩溃
问题描述
100% 加载依赖关系图后应用程序崩溃。构建 App 没有崩溃,只有从 Android 导航到 React Native 时才会崩溃。
我已经通过在 Android Studio 中将 Android Studio 迁移到 AndroidX,我也在使用 Jetifier。添加android.useAndroidX=true
和android.enableJetifier=true
。
我也按照@guyca https://github.com/wix/react-native-navigation/issues/5228的解决方案
随时向我询问更多信息以及我做了哪些步骤。谢谢!
MainActivity.js:
import android.os.Bundle;
import com.reactnativenavigation.NavigationActivity;
import org.devio.rn.splashscreen.SplashScreen;
public class MainActivity extends NavigationActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
SplashScreen.show(this, R.style.SplashTheme);
super.onCreate(savedInstanceState);
}
}
AndroidManifest.xml:
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="true"
android:theme="@style/AppTheme">
<!--This is the added-->
<activity
android:name=".SplashActivity"
android:label="@string/app_name"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize"
android:exported="true">
<!--<intent-filter>-->
<!--<action android:name="android.intent.action.MAIN" />-->
<!--<category android:name="android.intent.category.LAUNCHER" />-->
<!--</intent-filter>-->
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyAUqPyPlsIA9EtcsLF6oI832CYNoSLRuvY"
/>
</application>
我的环境:package.json
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest",
"android": "cd ./android && ./gradlew app:assembleDebug && ./gradlew installDebug",
"jetify": "npx jetify"
},
"dependencies": {
"core-js": "^3.1.4",
"jetifier": "^1.6.3",
"lodash": "^4.17.11",
"react": "16.8.3",
"react-native": "^0.60.4",
"react-native-android-location-services-dialog-box": "^2.8.1",
"react-native-fit-image": "^1.5.4",
"react-native-image-grid": "^1.0.0",
"react-native-linear-gradient": "^2.5.4",
"react-native-maps": "^0.25.0",
"react-native-navigation": "^3.0.0-alpha.2",
"react-native-splash-screen": "^3.2.0",
"react-native-tab-view": "^2.10.0",
"react-native-vector-icons": "^6.4.2",
"react-redux": "^7.0.2",
"redux": "^4.0.1",
"rn-bottom-drawer": "^1.4.3"
},
"devDependencies": {
"@babel/core": "^7.4.3",
"@babel/runtime": "^7.4.3",
"babel-jest": "^24.7.1",
"jest": "^24.7.1",
"jetifier": "^1.6.3",
"metro-react-native-babel-preset": "^0.53.1",
"react-test-renderer": "16.8.3"
},
"jest": {
"preset": "react-native"
}
解决方案
推荐阅读
- node.js - Postgress 尝试返回我的模型中不存在的列
- c# - ASP.NET Core:如何向我的视图添加第二个模型
- checkbox - 如何仅针对pyqt5中的选定复选框运行代码?
- javascript - 仅获取对象对象的一些键
- javascript - 如何在 React js 中立即更新状态值?
- reactjs - 自动完成材料 UI:当多个 = {false} 时,无法隐藏输入中的选定选项
- python - 如何自定义 URL 以通过请求获得所需的结果
- php - 让用户调用 php 方法的安全隐患
- javascript - 使用带有 CRA/react-scripts 的可选链接(?。)
- java - Java:平面列表