invertase / notifee

⚛️ A feature rich notifications library for React Native.
https://notifee.app
Apache License 2.0
1.88k stars 228 forks source link

[Android] add default constructor of NotifeeAlarmManager #1039

Closed YangJonghun closed 5 months ago

YangJonghun commented 6 months ago

below logs are collected (we use RN with enabled proguard and it occurred from only Android 8.0.0)

      Fatal Exception: java.lang.NoSuchMethodError: no non-static method "Lp5/i;.<init>()V"
       at com.pairip.VMRunner.executeVM(VMRunner.java)
       at com.pairip.VMRunner.invoke(VMRunner.java:59)
       at n.o.t.i.f.e.e.e.a(e.java:2)
       at app.notifee.core.RebootBroadcastReceiver.onReceive(SourceFile:3)
       at android.app.ActivityThread.handleReceiver(ActivityThread.java:3392)
       at android.app.ActivityThread.-wrap18()
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1780)
       at android.os.Handler.dispatchMessage(Handler.java:105)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6944)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

also small part of proguard mapping files are indicated below

app.notifee.core.b -> p5.i:
# {"id":"sourceFile","fileName":"SourceFile"}
    0:6:void <clinit>():1:1 -> <clinit>
    0:1:android.app.PendingIntent a(java.lang.String):1:1 -> a
    2:10:android.app.PendingIntent a(java.lang.String):2:2 -> a
    11:13:android.app.PendingIntent a(java.lang.String):3:3 -> a
    14:19:android.app.PendingIntent a(java.lang.String):6:6 -> a
    20:29:android.app.PendingIntent a(java.lang.String):7:7 -> a
    30:34:android.app.PendingIntent a(java.lang.String):14:14 -> a
    0:7:void a(app.notifee.core.model.NotificationModel,app.notifee.core.model.a):116:116 -> b
      # {"id":"com.android.tools.r8.residualsignature","signature":"(Lapp/notifee/core/model/NotificationModel;Li2/d;)V"}
    8:11:android.app.AlarmManager n.o.t.i.f.e.e.a.a():1:1 -> b
    8:11:void a(app.notifee.core.model.NotificationModel,app.notifee.core.model.a):118 -> b
    12:17:android.app.AlarmManager n.o.t.i.f.e.e.a.a():2:2 -> b
    12:17:void a(app.notifee.core.model.NotificationModel,app.notifee.core.model.a):118 -> b
    18:23:void a(app.notifee.core.model.NotificationModel,app.notifee.core.model.a):121:121 -> b
    24:29:void a(app.notifee.core.model.NotificationModel,app.notifee.core.model.a):122:122 -> b
    30:37:void a(app.notifee.core.model.NotificationModel,app.notifee.core.model.a):123:123 -> b
    38:40:void a(app.notifee.core.model.NotificationModel,app.notifee.core.model.a):131:131 -> b
    41:44:void a(app.notifee.core.model.NotificationModel,app.notifee.core.model.a):132:132 -> b
    45:64:void a(app.notifee.core.model.NotificationModel,app.notifee.core.model.a):133:133 -> b
    65:66:void a(app.notifee.core.model.NotificationModel,app.notifee.core.model.a):134:134 -> b
    67:78:void a(app.notifee.core.model.NotificationModel,app.notifee.core.model.a):135:135 -> b
    79:88:void a(app.notifee.core.model.NotificationModel,app.notifee.core.model.a):140:140 -> b
    89:92:void a(app.notifee.core.model.NotificationModel,app.notifee.core.model.a):141:141 -> b
    93:100:void a(app.notifee.core.model.NotificationModel,app.notifee.core.model.a):142:142 -> b
    101:104:void androidx.core.app.AlarmManagerCompat.setAlarmClock(android.app.AlarmManager,long,android.app.PendingIntent,android.app.PendingIntent):67:67 -> b
    101:104:void a(app.notifee.core.model.NotificationModel,app.notifee.core.model.a):143 -> b
    105:108:void androidx.core.app.AlarmManagerCompat.setAlarmClock(android.app.AlarmManager,long,android.app.PendingIntent,android.app.PendingIntent):66:66 -> b
    105:108:void a(app.notifee.core.model.NotificationModel,app.notifee.core.model.a):143 -> b
    109:116:void a(app.notifee.core.model.NotificationModel,app.notifee.core.model.a):144:144 -> b
    117:120:void androidx.core.app.AlarmManagerCompat.setExactAndAllowWhileIdle(android.app.AlarmManager,int,long,android.app.PendingIntent):228:228 -> b
    117:120:void a(app.notifee.core.model.NotificationModel,app.notifee.core.model.a):145 -> b
    121:128:void a(app.notifee.core.model.NotificationModel,app.notifee.core.model.a):146:146 -> b
    129:132:void androidx.core.app.AlarmManagerCompat.setExact(android.app.AlarmManager,int,long,android.app.PendingIntent):168:168 -> b
    129:132:void a(app.notifee.core.model.NotificationModel,app.notifee.core.model.a):147 -> b
    133:140:void a(app.notifee.core.model.NotificationModel,app.notifee.core.model.a):148:148 -> b
    141:144:void androidx.core.app.AlarmManagerCompat.setAndAllowWhileIdle(android.app.AlarmManager,int,long,android.app.PendingIntent):123:123 -> b
    141:144:void a(app.notifee.core.model.NotificationModel,app.notifee.core.model.a):149 -> b
    145:152:void a(app.notifee.core.model.NotificationModel,app.notifee.core.model.a):150:150 -> b
    153:156:void a(app.notifee.core.model.NotificationModel,app.notifee.core.model.a):151:151 -> b

it means we need to add default constructor of NotifeeAlarmManager.java (NotifeeAlarmManager constructor called within RebootBroadcastReceiver.java) or need to edit proguard rule for proguard doesn't remove default constructor

-keepclasseswithmembernames class app.notifee.core.** {
   public <init>(...);
}

It occurred from when we bump notifee version from v5.2.1 to v7.8.2

github-actions[bot] commented 5 months ago

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.