因此,最近我将我的原生react应用程序从使用框架的0.59版本更新为使用0.63。一切都很顺利,直到我注意到,在我将我的新.AAB文件上传到Google Play之后,我的用户中有一定百分比(大约10%)开始收到这个错误"dalvik.system.BaseDexClassLoader.findClass“。
经过调查,我发现这种情况只发生在一些(不是所有) API级别为28或29的设备上,如下面的仪表板所示:
这是堆栈跟踪:
java.lang.RuntimeException:
at android.app.ActivityThread.handleCreateService (ActivityThread.java:4268)
at android.app.ActivityThread.access$1500 (ActivityThread.java:270)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2067)
at android.os.Handler.dispatchMessage (Handler.java:107)
at android.os.Looper.loop (Looper.java:237)
at android.app.ActivityThread.main (ActivityThread.java:7948)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1075)
Caused by: java.lang.ClassNotFoundException:
at dalvik.system.BaseDexClassLoader.findClass (BaseDexClassLoader.java:196)
at java.lang.ClassLoader.loadClass (ClassLoader.java:379)
at java.lang.ClassLoader.loadClass (ClassLoader.java:312)
at android.app.AppComponentFactory.instantiateService (AppComponentFactory.java:129)
at androidx.core.app.CoreComponentFactory.instantiateService (CoreComponentFactory.java:75)
at android.app.ActivityThread.handleCreateService (ActivityThread.java:4263)我已经在互联网上搜索了一些解决方案,并尝试了其中的一些,但没有成功地解决它。有些人说它与MultiDex支持有关,但我很久以前就启用了它:
defaultConfig {
multiDexEnabled true
}还有:
dependencies {
def multidex_version = "2.0.1"
implementation 'androidx.multidex:multidex:2.0.1'
}如果有人能告诉我问题可能是什么,我将不胜感激。这是我的package.json:
"dependencies": {
"@react-native-community/async-storage": "1.12.0",
"@react-native-community/datetimepicker": "3.0.2",
"@react-native-community/masked-view": "^0.1.10",
"@react-native-community/netinfo": "5.9.7",
"@react-native-community/picker": "1.7.1",
"@react-native-community/push-notification-ios": "^1.5.0",
"EventEmitter": "1.0.0",
"aws-sdk": "2.757.0",
"axios": "0.18.0",
"blueimp-md5": "^2.10.0",
"firebase": "6.2.4",
"firebase-key": "2.0.2",
"jwt-decode": "^2.2.0",
"lodash": "4.17.5",
"mobx": "3.1.10",
"mobx-react": "4.2.1",
"mobx-remotedev": "0.2.8",
"mobx-utils": "2.0.2",
"moment": "^2.19.0",
"native-base": "2.13.14",
"ramda": "0.24.1",
"react": "16.13.1",
"react-native": "0.63.3",
"react-native-action-button": "^2.8.5",
"react-native-build-config": "0.3.2",
"react-native-camera": "3.40.0",
"react-native-code-push": "6.3.0",
"react-native-device-info": "6.0.2",
"react-native-document-picker": "2.3.0",
"react-native-fbsdk": "2.0.0",
"react-native-file-viewer": "2.1.4",
"react-native-gesture-handler": "^1.8.0",
"react-native-gifted-chat": "^0.16.3",
"react-native-hyperlink": "0.0.12",
"react-native-masked-text": "^1.5.3",
"react-native-mime-types": "^2.3.0",
"react-native-push-notification": "5.1.1",
"react-native-reanimated": "^1.13.0",
"react-native-safe-area-context": "^3.1.8",
"react-native-screens": "^2.11.0",
"react-native-tab-view": "^2.15.1",
"react-native-vector-icons": "7.1.0",
"react-native-webview": "10.9.0",
"react-navigation": "4.4.1",
"react-navigation-drawer": "2.5.1",
"react-navigation-stack": "2.8.3",
"react-navigation-tabs": "2.9.1",
"rn-fetch-blob": "0.12.0",
"uuid": "3.1.0",
"validator": "^9.4.1"
},
"devDependencies": {
"@babel/core": "^7.8.4",
"@babel/plugin-proposal-decorators": "7.4.4",
"@babel/preset-flow": "7.0.0",
"@babel/runtime": "^7.8.4",
"@react-native-community/eslint-config": "^1.1.0",
"@types/prop-types": "15.7.1",
"babel-eslint": "10.0.2",
"babel-jest": "^25.1.0",
"babel-preset-react-native": "4.0.1",
"eslint": "^6.5.1",
"eslint-config-airbnb": "17.1.0",
"eslint-import-resolver-reactnative": "^1.0.2",
"eslint-plugin-flowtype": "3.11.1",
"eslint-plugin-import": "2.17.3",
"eslint-plugin-jsx-a11y": "6.2.1",
"eslint-plugin-react": "7.14.1",
"flow-bin": "^0.65.0",
"grpc": "1.21.1",
"jest": "^25.1.0",
"jetifier": "^1.6.6",
"metro-react-native-babel-preset": "^0.59.0",
"react-test-renderer": "16.13.1"
}谢谢!
发布于 2020-11-19 13:44:16
我也犯了同样的错误,在我的例子中,它是一个缺少的类。
如果你有机会,得到一个有错误的设备,当发送反馈模式弹出时,点击预览按钮,向下滚动,然后选择'Stack trace‘。
找出遗漏的类对我来说很有效。
发布于 2020-12-03 01:45:21
我们设法修复了这个错误,方法是更新我们的zo0r/react-native-push-notification依赖项,并从过时的GCM通知格式( Amazon SNS理论上仍然支持这种格式,但新版本的zo0r/react-native-push-notification没有)迁移到FCM格式。
在这些更改之后,错误不再出现在Google Play控制台上。
https://stackoverflow.com/questions/64757874
复制相似问题