React Native 应用程序在 Proguard Enable 上崩溃

React Native app crashing on Proguard Enable

我有一个 React-Native 应用程序,它在调试时运行良好。但是该应用程序在发布版本时无法打开。

禁用混淆器可解决此问题。所以我开始寻找安装的每个第三方包的安装文档,我的 proguard 规则似乎很好。遗憾的是,我无法检测到是哪个软件包造成了这个问题。

我的问题是:我如何检测是哪个第三方包导致了这个问题

依赖关系:

{
  "dependencies": {
    "@gorhom/bottom-sheet": "^4.1.5",
    "@react-native-masked-view/masked-view": "^0.2.6",
    "@react-navigation/bottom-tabs": "^6.0.9",
    "@react-navigation/material-top-tabs": "^6.0.6",
    "@react-navigation/native": "^6.0.6",
    "@react-navigation/stack": "^6.0.11",
    "ky": "^0.28.7",
    "react": "^17.0.2",
    "react-native": "0.66.4",
    "react-native-android-location-enabler": "^1.2.2",
    "react-native-auto-height-image": "^3.2.4",
    "react-native-geolocation-service": "^5.3.0-beta.1",
    "react-native-gesture-handler": "^2.1.0",
    "react-native-image-crop-picker": "^0.36.0",
    "react-native-immersive-mode": "^2.0.0",
    "react-native-maps": "^0.29.4",
    "react-native-mmkv": "^1.5.4",
    "react-native-pager-view": "^5.4.9",
    "react-native-paper": "^4.11.1",
    "react-native-reanimated": "2.3.1",
    "react-native-safe-area-context": "^3.3.2",
    "react-native-screens": "^3.10.1",
    "react-native-tab-view": "^3.1.1",
    "react-native-vector-icons": "^9.0.0",
    "react-native-version-check": "^3.4.2",
    "react-query": "^3.34.5"
  },
}

Proguard 规则

-keep class com.facebook.hermes.unicode.** { *; }
-keep class com.facebook.jni.** { *; }
-keep class com.facebook.react.turbomodule.** { *; }

您可以测试发布版本并在控制台中查找错误。

https://reactnative.dev/docs/signed-apk-android#testing-the-release-build-of-your-app