I bubbled up my targetSdkVersion to 34 from 33 and the result is a quasi immediate crash (The whole crash report at the end of the question).
It looks like there is an issue with signatures:
Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Existing package com.olenergies.olenpepsmobile signatures do not match newer version; ignoring!]
And one related to Streams:
The following PlatformException was thrown while activating platform stream on channel flutter.baseflow.com/geolocator_service_updates_android:
PlatformException(error, com.olenergies.olenpepsmobile: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn’t being registered exclusively for system broadcasts, null, null)
I am a bit puzzled and would appreciate help to put me on the right track.
The whole log:
Launching lib/main.dart on Pixel 7 in debug mode...
Building with Flutter multidex support enabled.
✓ Built build/app/outputs/flutter-apk/app-debug.apk.
Error: ADB exited with exit code 1
Performing Streamed Install
adb: failed to install /Users/stephanedeluca/development/OlenPEPS-mobile/build/app/outputs/flutter-apk/app-debug.apk: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Existing package com.olenergies.olenpepsmobile signatures do not match newer version; ignoring!]
Uninstalling old version...
D/FlutterBluePlugin(19617): onAttachedToEngine
D/FlutterBluePlugin(19617): setup
D/FlutterBluePlugin(19617): onAttachedToActivity
D/FlutterGeolocator(19617): Attaching Geolocator to activity
D/FlutterGeolocator(19617): Creating service.
D/FlutterGeolocator(19617): Binding to location service.
D/FlutterGeolocator(19617): Geolocator foreground service connected
D/FlutterGeolocator(19617): Initializing Geolocator services
D/FlutterGeolocator(19617): Flutter engine connected. Connected engine count 1
Connecting to VM Service at ws://127.0.0.1:50826/bAf0OsM1Bl8=/ws
I/flutter (19617): Geolocator status: subscribing to stream
I/flutter (19617): Reading package information…
E/EventChannel#flutter.baseflow.com/geolocator_service_updates_android(19617): Failed to open event stream
E/EventChannel#flutter.baseflow.com/geolocator_service_updates_android(19617): java.lang.SecurityException: com.olenergies.olenpepsmobile: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts
E/EventChannel#flutter.baseflow.com/geolocator_service_updates_android(19617): at android.os.Parcel.createExceptionOrNull(Parcel.java:3183)
E/EventChannel#flutter.baseflow.com/geolocator_service_updates_android(19617): at android.os.Parcel.createException(Parcel.java:3167)
E/EventChannel#flutter.baseflow.com/geolocator_service_updates_android(19617): at android.os.Parcel.readException(Parcel.java:3150)
E/EventChannel#flutter.baseflow.com/geolocator_service_updates_android(19617): at android.os.Parcel.readException(Parcel.java:3092)
E/EventChannel#flutter.baseflow.com/geolocator_service_updates_android(19617): at android.app.IActivityManager$Stub$Proxy.registerReceiverWithFeature(IActivityManager.java:5860)
E/EventChannel#flutter.baseflow.com/geolocator_service_updates_android(19617): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1853)
E/EventChannel#flutter.baseflow.com/geolocator_service_updates_android(19617): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1793)
E/EventChannel#flutter.baseflow.com/geolocator_service_updates_android(19617): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1781)
E/EventChannel#flutter.baseflow.com/geolocator_service_updates_android(19617): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:757)
E/EventChannel#flutter.baseflow.com/geolocator_service_updates_android(19617): at com.baseflow.geolocator.LocationServiceHandlerImpl.onListen(LocationServiceHandlerImpl.java:58)
E/EventChannel#flutter.baseflow.com/geolocator_service_updates_android(19617): at io.flutter.plugin.common.EventChannel$IncomingStreamRequestHandler.onListen(EventChannel.java:218)
E/EventChannel#flutter.baseflow.com/geolocator_service_updates_android(19617): at io.flutter.plugin.common.EventChannel$IncomingStreamRequestHandler.onMessage(EventChannel.java:197)
E/EventChannel#flutter.baseflow.com/geolocator_service_updates_android(19617): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/EventChannel#flutter.baseflow.com/geolocator_service_updates_android(19617): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$DartMessenger(DartMessenger.java:322)
E/EventChannel#flutter.baseflow.com/geolocator_service_updates_android(19617): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/EventChannel#flutter.baseflow.com/geolocator_service_updates_android(19617): at android.os.Handler.handleCallback(Handler.java:959)
E/EventChannel#flutter.baseflow.com/geolocator_service_updates_android(19617): at android.os.Handler.dispatchMessage(Handler.java:100)
E/EventChannel#flutter.baseflow.com/geolocator_service_updates_android(19617): at android.os.Looper.loopOnce(Looper.java:232)
E/EventChannel#flutter.baseflow.com/geolocator_service_updates_android(19617): at android.os.Looper.loop(Looper.java:317)
E/EventChannel#flutter.baseflow.com/geolocator_service_updates_android(19617): at android.app.ActivityThread.main(ActivityThread.java:8592)
E/EventChannel#flutter.baseflow.com/geolocator_service_updates_android(19617): at java.lang.reflect.Method.invoke(Native Method)
E/EventChannel#flutter.baseflow.com/geolocator_service_updates_android(19617): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
E/EventChannel#flutter.baseflow.com/geolocator_service_updates_android(19617): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)
E/EventChannel#flutter.baseflow.com/geolocator_service_updates_android(19617): Caused by: android.os.RemoteException: Remote stack trace:
E/EventChannel#flutter.baseflow.com/geolocator_service_updates_android(19617): at com.android.server.am.ActivityManagerService.registerReceiverWithFeature(ActivityManagerService.java:14467)
E/EventChannel#flutter.baseflow.com/geolocator_service_updates_android(19617): at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2648)
E/EventChannel#flutter.baseflow.com/geolocator_service_updates_android(19617): at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2822)
E/EventChannel#flutter.baseflow.com/geolocator_service_updates_android(19617): at android.os.Binder.execTransactInternal(Binder.java:1500)
E/EventChannel#flutter.baseflow.com/geolocator_service_updates_android(19617): at android.os.Binder.execTransact(Binder.java:1444)
E/EventChannel#flutter.baseflow.com/geolocator_service_updates_android(19617):
W/Activity(19617): Can request only one set of permissions at a time
D/WifiScanPlugin(19617): onRequestPermissionsResult: arguments (1452, [Ljava.lang.String;@decb7e2, [I@89d5773)
D/WifiScanPlugin(19617): requestPermissionCookie: {}
W/Activity(19617): Can request only one set of permissions at a time
D/WifiScanPlugin(19617): onRequestPermissionsResult: arguments (6567854, [Ljava.lang.String;@1957630, [I@fc622a9)
D/WifiScanPlugin(19617): requestPermissionCookie: {6567854=Function1<int[], java.lang.Boolean>}
D/WifiScanPlugin(19617): permissionResultCallback: args([I@fc622a9)
W/WindowOnBackDispatcher(19617): OnBackInvokedCallback is not enabled for the application.
W/WindowOnBackDispatcher(19617): Set 'android:enableOnBackInvokedCallback="true"' in the application manifest.
════════ Exception caught by services library ══════════════════════════════════
The following PlatformException was thrown while activating platform stream on channel flutter.baseflow.com/geolocator_service_updates_android:
PlatformException(error, com.olenergies.olenpepsmobile: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts, null, null)
When the exception was thrown, this was the stack:
#0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:651:7)
#1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:322:18)
<asynchronous suspension>
#2 EventChannel.receiveBroadcastStream.<anonymous closure> (package:flutter/src/services/platform_channel.dart:664:9)
<asynchronous suspension>
════════════════════════════════════════════════════════════════════════════════
I/flutter (19617): Read the information 1.3.16
I/flutter (19617): WiFi scanner: CanGetScannedResults.noLocationPermissionRequired
I/flutter (19617): Geolocator status: inital value for _isLocationEnabled is true
W/Activity(19617): Can request only one set of permissions at a time
D/WifiScanPlugin(19617): onRequestPermissionsResult: arguments (109, [Ljava.lang.String;@8e9613a, [I@3da41eb)
D/WifiScanPlugin(19617): requestPermissionCookie: {6567854=Function1<int[], java.lang.Boolean>}
I/Geolocator(19617): The grantResults array is empty. This can happen when the user cancels the permission request
I/flutter (19617): An error occured while trying to get your device location: User denied permissions to access the device's location.
D/CompatibilityChangeReporter(19617): Compat change id reported: 78294732; UID 10467; state: ENABLED
D/WifiScanPlugin(19617): onRequestPermissionsResult: arguments (24, [Ljava.lang.String;@f900819, [I@f2140de)
D/WifiScanPlugin(19617): requestPermissionCookie: {6567854=Function1<int[], java.lang.Boolean>}
I/flutter (19617): Location permission is granted
I/flutter (19617): Location when in use permission is granted
I/flutter (19617): Geolocator status: subscribing to stream
I/flutter (19617): Reading package information…
I/flutter (19617): Read the information 1.3.16
I/flutter (19617): Location permission is granted
I/flutter (19617): Geolocator status: inital value for _isLocationEnabled is true
I/flutter (19617): Start scanning ble devices nearby…
I/flutter (19617): SCANNING: false
W/Activity(19617): Can request only one set of permissions at a time
D/WifiScanPlugin(19617): onRequestPermissionsResult: arguments (1454, [Ljava.lang.String;@ffc8cea, [I@8737bdb)
D/WifiScanPlugin(19617): requestPermissionCookie: {6567854=Function1<int[], java.lang.Boolean>}
I/flutter (19617): isScanning: true
I/flutter (19617): isScanning: true
I/flutter (19617): Location when in use permission is granted
I/flutter (19617): ➜ Translation key in 'en_us' is missing: "1Un appareil bluetooth analyséM%d appareils bluetooth analysés".
I/flutter (19617): ➜ Translation key in 'en_us' is missing: "1Un appareil bluetooth analyséM%d appareils bluetooth analysés".
I/flutter (19617): Dispose (Geolocator status: )
I/flutter (19617): Stop scanning ble devices nearby
D/BluetoothAdapter(19617): isLeEnabled(): ON
D/BluetoothLeScanner(19617): could not find callback wrapper
I/flutter (19617): Done stopScan()
I/flutter (19617): isScanning: false
D/WifiScanPlugin(19617): onRequestPermissionsResult: arguments (1453, [Ljava.lang.String;@a57cc90, [I@f162989)
D/WifiScanPlugin(19617): requestPermissionCookie: {6567854=Function1<int[], java.lang.Boolean>}
D/FlutterBluePlugin(19617): mDevices size: 0
I/flutter (19617): Scanning connected devices: found 0
I/flutter (19617): Start scanning ble devices nearby…
I/flutter (19617): SCANNING: false
I/flutter (19617): isScanning: true
I/flutter (19617): ➜ Translation key in 'en_us' is missing: "1Un appareil bluetooth analyséM%d appareils bluetooth analysés".
D/WifiScanPlugin(19617): onRequestPermissionsResult: arguments (1455, [Ljava.lang.String;@3ca049a, [I@38711cb)
D/WifiScanPlugin(19617): requestPermissionCookie: {6567854=Function1<int[], java.lang.Boolean>}
D/BluetoothAdapter(19617): isLeEnabled(): ON
D/BluetoothLeScanner(19617): onScannerRegistered() - status=0 scannerId=8 mScannerId=0
D/AndroidRuntime(19617): Shutting down VM
E/AndroidRuntime(19617): FATAL EXCEPTION: main
E/AndroidRuntime(19617): Process: com.olenergies.olenpepsmobile, PID: 19617
E/AndroidRuntime(19617): java.lang.ExceptionInInitializerError
E/AndroidRuntime(19617): at com.boskokg.flutter_blue_plus.FlutterBluePlusPlugin$2.onScanResult(FlutterBluePlusPlugin.java:1045)
E/AndroidRuntime(19617): at android.bluetooth.le.BluetoothLeScanner$BleScanCallbackWrapper$1.run(BluetoothLeScanner.java:568)
E/AndroidRuntime(19617): at android.os.Handler.handleCallback(Handler.java:959)
E/AndroidRuntime(19617): at android.os.Handler.dispatchMessage(Handler.java:100)
E/AndroidRuntime(19617): at android.os.Looper.loopOnce(Looper.java:232)
E/AndroidRuntime(19617): at android.os.Looper.loop(Looper.java:317)
E/AndroidRuntime(19617): at android.app.ActivityThread.main(ActivityThread.java:8592)
E/AndroidRuntime(19617): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(19617): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
E/AndroidRuntime(19617): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)
E/AndroidRuntime(19617): Caused by: java.lang.IllegalArgumentException: UUID string too large
E/AndroidRuntime(19617): at java.util.UUID.fromStringJava11(UUID.java:238)
E/AndroidRuntime(19617): at java.util.UUID.fromString(UUID.java:226)
E/AndroidRuntime(19617): at com.boskokg.flutter_blue_plus.ProtoMaker.<clinit>(ProtoMaker.java:35)
E/AndroidRuntime(19617): ... 10 more
I/Process (19617): Sending signal. PID: 19617 SIG: 9
Lost connection to device.
Exited.
2
Answers
Step 1: Check in the all project if you register a receiver:
Step 2: Update to be compatible with Android 14+
One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts
Step 3:
Aditional Info:
Example of the android native project:
https://prnt.sc/BXODTuUsa-KW
goto ProtoMaker.java:35
and delete the word "static"
it works for me using flutter_blue, and upgraded to SDK 34
^_^