SecurityException:com.mobileapp.boa:应指定 RECEIVER_EXPORTED 或 RECEIVER_NOT_EXPORTED 之一

问题描述 投票:0回答:1

我正在尝试将我的 Flutter 应用程序的 Android targetSK 和compileSDK 版本升级到 34。但是,在 Android 14 上运行发布 .apk 文件时,我收到以下错误。我尝试查看所有 flutter 依赖项,但无法找到找到一个没有指定接收者的。我怎样才能找出导致问题的原因?

请帮忙,谢谢!

颤振版本:3.24.4 JDK:21 AGP版本:8.7.2 摇篮版本:8.9

错误:

E/AndroidRuntime(27657): FATAL EXCEPTION: main
E/AndroidRuntime(27657): Process: com.mobileapp.boa, PID: 27657
E/AndroidRuntime(27657): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.mobileapp.boa/com.mobg.SecurityException: com.mobileapp.boa: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receively for system broadcasts
E/AndroidRuntime(27657):        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4047)
E/AndroidRuntime(27657):        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4322)
E/AndroidRuntime(27657):        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
E/AndroidRuntime(27657):        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.j
E/AndroidRuntime(27657):        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:96)
E/AndroidRuntime(27657):        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2685)
E/AndroidRuntime(27657):        at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(27657):        at android.os.Looper.loopOnce(Looper.java:230)
E/AndroidRuntime(27657):        at android.os.Looper.loop(Looper.java:319)
E/AndroidRuntime(27657):        at android.app.ActivityThread.main(ActivityThread.java:8919)
E/AndroidRuntime(27657):        at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(27657):        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
E/AndroidRuntime(27657):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
E/AndroidRuntime(27657):        at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:772)
E/AndroidRuntime(27657):        at g2.c.<init>(Unknown Source:70)
E/AndroidRuntime(27657):        at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:772)
E/AndroidRuntime(27657):        at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:772)
E/AndroidRuntime(27657):        at g2.c.<init>(Unknown Source:70)
E/AndroidRuntime(27657):        at p2.a$e.<init>(Unknown Source:0)
E/AndroidRuntime(27657):        at p2.a.d(Unknown Source:54)
E/AndroidRuntime(27657):        at o2.c.<init>(SourceFile:7)
E/AndroidRuntime(27657):        at o2.c.<init>(SourceFile:1)
E/AndroidRuntime(27657):        at o2.c$b.b(Unknown Source:2)
E/AndroidRuntime(27657):        at o2.c$b.a(Unknown Source:1)
E/AndroidRuntime(27657):        at com.mobileapp.boa.MainActivity.<init>(Unknown Source:7)
E/AndroidRuntime(27657):        at java.lang.Class.newInstance(Native Method)
E/AndroidRuntime(27657):        at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95)        
E/AndroidRuntime(27657):        at androidx.core.app.CoreComponentFactory.instantiateActivity(Unknown Source:0)
E/AndroidRuntime(27657):        at android.app.Instrumentation.newActivity(Instrumentation.java:1378)
E/AndroidRuntime(27657):        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4034)
E/AndroidRuntime(27657):        ... 12 more
E/AndroidRuntime(27657): Caused by: android.os.RemoteException: Remote stack trace:
E/AndroidRuntime(27657):        at com.android.server.am.ActivityManagerService.registerReceiverWithFeature(ActivityManagerService.java:16680)
E/AndroidRuntime(27657):        at android.app.IActivityManager$Stub.onTransact$registerReceiverWithFeature$(IActivityManager.java:11613)
E/AndroidRuntime(27657):        at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2961)
E/AndroidRuntime(27657):        at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3199)
E/AndroidRuntime(27657):        at android.os.Binder.execTransactInternal(Binder.java:1375)
E/AndroidRuntime(27657):

pubspec.yaml 依赖项:

  barcode_scan2: ^4.3.3
  bloc_concurrency: ^0.2.5
  cached_network_image: ^3.4.1
  carousel_slider: ^5.0.0
  clippy_flutter: ^2.0.0-nullsafety.1
  connectivity_plus: ^6.1.0
  cupertino_icons: ^1.0.8
  custom_info_window: ^1.0.1
  dio: ^5.7.0
  dropdown_button2: ^2.3.9
  dropdown_search: ^6.0.1
  email_validator: ^3.0.0
  equatable: ^2.0.3
  file_picker: ^8.1.3
  file_saver: ^0.2.14
  firebase_analytics: ^11.3.4
  firebase_core: ^3.7.0
  fl_country_code_picker: ^0.1.9+1
  flutter_bloc: ^8.1.6
  flutter_cached_pdfview: ^0.4.3
  flutter_downloader: ^1.11.8
  flutter_email_sender: ^6.0.3
  flutter_inappwebview: ^6.1.5
  # flutter_native_timezone: ^2.0.0
  flutter_timezone: ^3.0.1
  flutter_pdfview: ^1.3.4
  # flutter_phone_direct_caller: ^2.1.1
  flutter_slidable: ^3.1.1
  flutter_staggered_grid_view: ^0.7.0
  flutter_typeahead: ^5.2.0
  flutter_uxcam: ^2.5.5
  fluttertoast: ^8.2.8
  formz: ^0.4.0
  geocoding: ^3.0.0
  geolocator: ^13.0.1
  google_api_headers: ^4.2.5
  google_maps_flutter: ^2.9.0
  google_maps_webservice: ^0.0.19
  google_mlkit_text_recognition: ^0.14.0
  google_places_flutter: ^2.0.0
  http: ^1.2.2
  http_interceptor: ^1.0.2
  image_picker: ^1.1.2
  intl: ^0.19.0
  intl_phone_field: ^3.2.0
  json_response: ^1.0.0
  location: ^7.0.1
  maps_launcher: ^2.2.1
  mime: ^2.0.0
  oauth2: ^2.0.0
  omni_datetime_picker: ^2.0.4
  open_file: ^3.5.9
  path_provider: ^2.1.4
  percent_indicator: ^4.2.3
  permission_handler: ^11.3.1
  pin_code_fields: ^8.0.1
  provider: ^6.1.2
  s_network_connection_checker: ^0.0.1+1
  shared_preferences: ^2.3.2
  sqflite: ^2.4.1
  # uni_links: ^0.5.1
  url_launcher: ^6.3.1
  webview_flutter: ^4.10.0
android flutter android-api-34
1个回答
0
投票

更新AndroidManifest.xml并根据需要指定是否导出broadcastReceiver

android:exported="true"

android:exported="false"
© www.soinside.com 2019 - 2024. All rights reserved.