Closed aykutuludag closed 10 months ago
Another bug in Android 5
Fatal Exception: java.lang.NoSuchMethodError: No virtual method setExactAndAllowWhileIdle(IJLandroid/app/PendingIntent;)V in class Landroid/app/AlarmManager; or its super classes (declaration of 'android.app.AlarmManager' appears in /system/framework/framework.jar:classes2.dex)
at com.gdelataillade.alarm.alarm.AlarmPlugin.handleDelayedAlarm(AlarmPlugin.java:1)
at com.gdelataillade.alarm.alarm.AlarmPlugin.onMethodCall(AlarmPlugin.java:1)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:1)
at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:1)
at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0(DartMessenger.java:1)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6934)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
Another bug in Android 6 and 7
Fatal Exception: java.lang.NoSuchMethodError: No direct method <init>(Landroid/content/Context;Ljava/lang/String;)V in class Landroid/app/Notification$Builder; or its super classes (declaration of 'android.app.Notification$Builder' appears in /system/framework/framework.jar)
at com.gdelataillade.alarm.alarm.NotificationHandler.buildNotification(NotificationHandler.java:1)
at com.gdelataillade.alarm.alarm.AlarmService.onStartCommand(AlarmService.java)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4132)
at android.app.ActivityThread.access$2400(ActivityThread.java:229)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1924)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7406)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Another bug in Android 14.
Fatal Exception: java.lang.RuntimeException: Unable to start service com.gdelataillade.alarm.alarm.AlarmService@ebc8049 with Intent { cmp=APP.PACKAGENAME/com.gdelataillade.alarm.alarm.AlarmService (has extras) }: android.app.MissingForegroundServiceTypeException: Starting FGS without a type callerApp=ProcessRecord{265d1d2 10234:APP.PACKAGENAME/u0a389} targetSDK=34
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5286)
at android.app.ActivityThread.-$$Nest$mhandleServiceArgs()
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2531)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:230)
at android.os.Looper.loop(Looper.java:319)
at android.app.ActivityThread.main(ActivityThread.java:8893)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:608)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
Also it takes extra work to switch to Gradle 8.1.2 from 7.4.2 for this alarm plugin. For anyone encounter errors, please refer this: https://stackoverflow.com/questions/76108428/how-do-i-fix-namespace-not-specified-error-in-android-studio/77738936#77738936
Facing the same issue here The exception Unable to start service com.gdelataillade.alarm.alarm.AlarmService@ebc8049 with Intent { cmp={}/com.gdelataillade.alarm.alarm.AlarmService (has extras) }: android.app.MissingForegroundServiceTypeException: Starting FGS without a type callerApp=ProcessRecord{265d1d2 10234:{}} targetSDK=34 happens exactly at the time the alarm is supposed to be thrown. I'm testing on a Android 14 with Play Store pixel 4 emulator. Did all the recommended setup, but instead of targetSdk 33, I'm using the 34 (Android 14)
Hi @aykutuludag
Thanks a lot for sharing these bugs. I will take a look at them and publish a fix as soon as possible.
Hi @aykutuludag
Thanks a lot for sharing these bugs. I will take a look at them and publish a fix as soon as possible.
No problem @gdelataillade . My app has an extensive userbase in Android 5 to 14 and same thing for iOS. I will keep sharing new errors on both iOS & Android.
Thanks for taking care of the bugs. Best wishes
Only happened once but it may triggered again.
PlatformException(error, Not allowed to start service Intent { act=STOP_ALARM cmp=app.packagename/com.gdelataillade.alarm.alarm.AlarmService (has extras) }: app is in background uid UidRecord{879dd52 u0a300 TPSL idle change:cached procs:0 seq(0,0,0)}, null, android.app.BackgroundServiceStartNotAllowedException: Not allowed to start service Intent { act=STOP_ALARM cmp=app.packagename/com.gdelataillade.alarm.alarm.AlarmService (has extras) }: app is in background uid UidRecord{879dd52 u0a300 TPSL idle change:cached procs:0 seq(0,0,0)} at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1872) at android.app.ContextImpl.startService(ContextImpl.java:1828) at android.content.ContextWrapper.startService(ContextWrapper.java:786) at com.gdelataillade.alarm.alarm.a.onMethodCall(SourceFile:1) at i6.k$a.a(SourceFile:1) at a6.c.l(SourceFile:1) at a6.c.m(SourceFile:1) at a6.c.f(SourceFile:1) at a6.b.run(SourceFile:1) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:210) at android.os.Looper.loop(Looper.java:299) at android.app.ActivityThread.main(ActivityThread.java:8309) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1038) )
I'm started to getting error from iOS side too. Here is one of them:
Fatal Exception: FlutterError
PlatformException(NATIVE_ERR, [Alarm] Audio player not found for ID: 63, null, null)
Fatal Exception: FlutterError
0 ??? 0x0 IOSAlarm.setAlarm + 59 (ios_alarm.dart:59)
1 ??? 0x0 (null).createAlarm + 64 (alarm_utils.dart:64)
For now it seems more stable than Android. I will share if I get new crash reports.
Note: Background audio is enabled. Plugin installed as referred from documentation.
Note2: This error happened in my iPhone 14. You are seeing those logs. I'm getting notifications I didn't encountered any problem on that. But app sometimes crashing (Not all the time, I couldn't understand why).
Note3: Once you published the new version, I will implement it immediately and release new version to check if errors gone and reports back.
@aykutuludag
Huge thanks for reporting these bugs with all the details. There are very valuable because I only have an Android 11 device to test the plugin and every Android version works differently.
I'm currently working on fixing them. I added more version checks to handle better the different versions of Android. I'll let you know when I'll make a new release.
A new error occurred in iOS:
Crashed: com.apple.root.default-qos
0 libswiftCore.dylib 0x400034 swift_isUniquelyReferenced_nonNull_native + 38
1 alarm 0x9b8c $s5alarm16SwiftAlarmPluginC03setC033_6E2EED5D4137BAF8EC3EC9399D6BB069LL4call6resultySo17FlutterMethodCallC_yypSgXEtF + 5620
2 alarm 0x10750 $s5alarm16SwiftAlarmPluginC6handle_6resultySo17FlutterMethodCallC_yypSgctFyyYbcfU_TA + 428
3 alarm 0xa4ac $sIegh_IeyBh_TRTm + 28
4 libdispatch.dylib 0x26a8 _dispatch_call_block_and_release + 32
5 libdispatch.dylib 0x4300 _dispatch_client_callout + 20
6 libdispatch.dylib 0x744c _dispatch_queue_override_invoke + 928
7 libdispatch.dylib 0x15be4 _dispatch_root_queue_drain + 392
8 libdispatch.dylib 0x163ec _dispatch_worker_thread2 + 156
9 libsystem_pthread.dylib 0x1928 _pthread_wqthread + 228
10 libsystem_pthread.dylib 0x1a04 start_wqthread + 8
Crashed: com.apple.root.default-qos
0 CoreFoundation 0x819d0 CFGetTypeID + 92
1 CoreFoundation 0x26480 __CFPropertyListIsValidAux + 60
2 CoreFoundation 0x90fb4 CFPropertyListCreateData + 220
3 libAudioToolboxUtility.dylib 0x5858 CASerializer::WritePlist(void const*) + 44
4 AudioToolbox 0x1e090 <redacted> + 40
5 AudioToolbox 0x1e19c <redacted> + 64
6 libAudioToolboxUtility.dylib 0x3ecc PropertyMarshaller::Serialize(unsigned int, void const*, unsigned int, PropertyMarshaller::EClientServer) + 232
7 AudioToolbox 0x1dfdb4 AudioQueueSetProperty + 400
8 AVFAudio 0x9f4f0 AVAudioPlayerCpp::prepareToPlayQueue() + 272
9 AVFAudio 0x9f2b8 AVAudioPlayerCpp::playQueue(AudioTimeStamp const*) + 116
10 AVFAudio 0x9ee8c AVAudioPlayerCpp::DoAction(unsigned int, unsigned long, void const*) + 168
11 AVFAudio 0x40eac -[AVAudioPlayer play] + 40
12 alarm 0xa944 $s5alarm16SwiftAlarmPluginC16startSilentSound33_6E2EED5D4137BAF8EC3EC9399D6BB069LLyyF + 824
13 alarm 0x9f6c $s5alarm16SwiftAlarmPluginC03setC033_6E2EED5D4137BAF8EC3EC9399D6BB069LL4call6resultySo17FlutterMethodCallC_yypSgXEtF + 6612
14 alarm 0x10750 $s5alarm16SwiftAlarmPluginC6handle_6resultySo17FlutterMethodCallC_yypSgctFyyYbcfU_TA + 428
15 alarm 0xa4ac $sIegh_IeyBh_TRTm + 28
16 libdispatch.dylib 0x2320 _dispatch_call_block_and_release + 32
17 libdispatch.dylib 0x3eac _dispatch_client_callout + 20
18 libdispatch.dylib 0x6f8c _dispatch_queue_override_invoke + 788
19 libdispatch.dylib 0x15944 _dispatch_root_queue_drain + 396
20 libdispatch.dylib 0x16158 _dispatch_worker_thread2 + 164
21 libsystem_pthread.dylib 0xda0 _pthread_wqthread + 228
22 libsystem_pthread.dylib 0xb7c start_wqthread + 8
I guess this problem happens while showing notification.
Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x1c20 objc_msgSend + 32
1 CoreFoundation 0x373b4 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 148
2 CoreFoundation 0xde444 ___CFXRegistrationPost_block_invoke + 88
3 CoreFoundation 0xc16f4 _CFXRegistrationPost + 440
4 CoreFoundation 0x4b9b8 _CFXNotificationPost + 704
5 Foundation 0x5cd0c -[NSNotificationCenter postNotificationName:object:userInfo:] + 92
6 AudioSession 0x1c3f8 __63-[AVAudioSession privatePostNotificationForType:name:userInfo:]_block_invoke + 72
7 libdispatch.dylib 0x2460 _dispatch_call_block_and_release + 32
8 libdispatch.dylib 0x3f88 _dispatch_client_callout + 20
9 libdispatch.dylib 0x127f4 _dispatch_main_queue_drain + 928
10 libdispatch.dylib 0x12444 _dispatch_main_queue_callback_4CF + 44
11 CoreFoundation 0x9a6c8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
12 CoreFoundation 0x7c02c __CFRunLoopRun + 2036
13 CoreFoundation 0x80eb0 CFRunLoopRunSpecific + 612
14 GraphicsServices 0x1368 GSEventRunModal + 164
15 UIKitCore 0x3a1668 -[UIApplication _run] + 888
16 UIKitCore 0x3a12cc UIApplicationMain + 340
17 Runner 0x869c main + 7 (AppDelegate.swift:7)
18 ??? 0x1dc9e0960 (Missing)
Hi @aykutuludag
I just released version 3.0.3
with some Android fixes. I hope it will reduce the number of issues on Android. I'll take a look at iOS issues a bit later. Thanks again for your valuable feedback.
Hi @aykutuludag
I just released version
3.0.3
with some Android fixes. I hope it will reduce the number of issues on Android. I'll take a look at iOS issues a bit later. Thanks again for your valuable feedback.
I will release new version to my app today with Alarm v3.0.3. I will share my findings in new file. Have a nice day...
Awesome !
Don't forget to run a few test before releasing in production your app when you upgrade alarm package version. We never know.
Alarm plugin version 3.0.2
Describe the bug It is getting exception in Android 10, 11, 12, 13.
To Reproduce Nothing. I did standard implementation of plugin. It is working perfectly but firebase says I'm getting error in some devices. It may not working perfectly on those devices maybe.
Expected behavior Working without exception
Screenshots
Device info Most popular devices working on >= Android10
Additional context
MY CODE:
After initiating in main function with await Alarm.init() I'm using following code to create alarms.
In AndroidManifest.xml