java - Android 崩溃:java.lang.RuntimeException:在 android.app.ActivityThread.performResumeActivity
问题描述
此错误发生在内部测试中(在开发中从未见过),并且到目前为止仅报告了一个用户,在一台设备上,其规格为:
- 小米红米6A
- 安卓 8.1 (SDK 27)
它也是一个使用(一些可能相关的包)构建的 ReactNative 应用程序:
- “反应原生”:“〜0.63.4”,
- "世博": "^41.0.0",
- “博览会许可”:“〜12.0.1”,
以下是 GooglePlay Console 上的日志:
java.lang.RuntimeException:
at android.app.ActivityThread.performResumeActivity (ActivityThread.java:3657)
at android.app.ActivityThread.handleResumeActivity (ActivityThread.java:3697)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1690)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:176)
at android.app.ActivityThread.main (ActivityThread.java:6662)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:873)
Caused by: java.lang.NullPointerException:
at java.util.Objects.requireNonNull (Objects.java:203)
at expo.modules.location.LocationModule.handleForegroundLocationPermissions (LocationModule.java:16)
at expo.modules.location.LocationModule.lambda$requestForegroundPermissionsAsync$2 (LocationModule.java)
at expo.modules.location.LocationModule.lambda$requestForegroundPermissionsAsync$2$LocationModule (LocationModule.java)
at expo.modules.location.-$$Lambda$LocationModule$k4oVIWX5Tq-1bJGiv_G_lWYmJ10.onResult (-.java:4)
at org.unimodules.adapters.react.permissions.PermissionsService$createListenerWithPendingPermissionsRequest$1.onRequestPermissionsResult (PermissionsService.java:32)
at com.facebook.react.ReactActivityDelegate$2.invoke (ReactActivityDelegate.java:20)
at com.facebook.react.ReactActivityDelegate.onResume (ReactActivityDelegate.java:12)
at com.facebook.react.ReactActivity.onResume (ReactActivity.java:5)
at android.app.Instrumentation.callActivityOnResume (Instrumentation.java:1355)
at android.app.Activity.performResume (Activity.java:7182)
at android.app.ActivityThread.performResumeActivity (ActivityThread.java:3632)
at android.app.ActivityThread.handleResumeActivity (ActivityThread.java:3697)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1690)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:176)
at android.app.ActivityThread.main (ActivityThread.java:6662)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:873)
如果有帮助,下面还有应用程序的 MainActivity
// Added automatically by Expo Config
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
Intent intent = new Intent("onConfigurationChanged");
intent.putExtra("newConfig", newConfig);
sendBroadcast(intent);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(null);
// SplashScreen.show(...) has to be called after super.onCreate(...)
// Below line is handled by '@expo/configure-splash-screen' command and it's discouraged to modify it manually
SplashScreen.show(this, SplashScreenImageResizeMode.CONTAIN, ReactRootView.class, false);
}
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "main";
}
@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new ReactActivityDelegate(this, getMainComponentName()) {
@Override
protected ReactRootView createRootView() {
return new RNGestureHandlerEnabledRootView(MainActivity.this);
}
};
}
}
任何帮助将不胜感激!
我也承认,任何使用 Crashlytics 之类的工具都会让生活变得更轻松,而且它们目前还没有集成。但是,如果这是唯一可以解决的方法,我也可以这样做,稍后……谢谢!
解决方案
似乎没有授予位置权限
java.lang.NullPointerException: at java.util.Objects.requireNonNull (Objects.java:203) at expo.modules.location.LocationModule.handleForegroundLocationPermissions (LocationModule.java:16) at expo.modules.location.LocationModule.lambda$requestForegroundPermissionsAsync$2 (LocationModule.java) at expo.modules.location.LocationModule.lambda$requestForegroundPermissionsAsync$2$LocationModule (LocationModule.java)
推荐阅读
- html - 如何将文本及其边框与图像集中在一起?
- angular - Jest 26 & Angular - 错误报告错误行号
- javascript - 如何在关闭窗口时使用按钮?
- django - 反向 django 自定义管理站点 URL
- asp.net - 从下拉列表中获取 ID?
- ruby-on-rails - Bitbucket 管道 - 是否可以在服务和使用该服务的步骤之间共享文件夹?
- javascript - DataTables - 过滤和比较多列
- google-cloud-platform - 如何安排 AppEngine Flex 实例在 Google Cloud 中停止和启动?
- sharepoint - Sharepoint 列表适配器到 SSIS - 401 NTLM 错误
- react-native - 前台服务访问位置时的权限声明表