Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: SDK Crashes on release/app bundle build when not all onesignal modules are included: Service interface i6.a could not be instantiated #1969

Open
1 task done
CarlBarks opened this issue Jan 22, 2024 · 2 comments

Comments

@CarlBarks
Copy link

CarlBarks commented Jan 22, 2024

What happened?

The application crashes on startup with the following error. It happens only on release/app bundle builds with proguard enabled and works as expected on debug builds.

FATAL EXCEPTION: main
                                                                                                                Process: xxxx, PID: 13210
                                                                                                                java.lang.RuntimeException: Unable to create application xxxx: java.lang.Exception: Service interface i6.a could not be instantiated
                                                                                                                	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6764)
                                                                                                                	at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
                                                                                                                	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2133)
                                                                                                                	at android.os.Handler.dispatchMessage(Handler.java:106)
                                                                                                                	at android.os.Looper.loopOnce(Looper.java:201)
                                                                                                                	at android.os.Looper.loop(Looper.java:288)
                                                                                                                	at android.app.ActivityThread.main(ActivityThread.java:7872)
                                                                                                                	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                                	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
                                                                                                                	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
                                                                                                                Caused by: java.lang.Exception: Service interface i6.a could not be instantiated
                                                                                                                	at l5.d.getService(Unknown Source:58)
                                                                                                                	at com.onesignal.internal.a.initWithContext(Unknown Source:257)
                                                                                                                	at j5.b.e(Unknown Source:16)
                                                                                                                	at xxx.onCreate(Unknown Source:80)
                                                                                                                	at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1277)
                                                                                                                	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6759)
                                                                                                                	at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0) 
                                                                                                                	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2133) 
                                                                                                                	at android.os.Handler.dispatchMessage(Handler.java:106) 
                                                                                                                	at android.os.Looper.loopOnce(Looper.java:201) 
                                                                                                                	at android.os.Looper.loop(Looper.java:288) 
                                                                                                                	at android.app.ActivityThread.main(ActivityThread.java:7872) 
                                                                                                                	at java.lang.reflect.Method.invoke(Native Method) 
                                                                                                                	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) 
                                                                                                                	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936) 

OneSignal SDK Version is at 5.1.1 but also happens on 5.1.0.

Similar issues that were studied are #1810 and #1857 but no proguard rules helped fix the issue.

OneSignal is initiated as
OneSignal.initWithContext(this, one_signal_app_id)

Steps to reproduce?

Include only the partial onesignal module dependencies

dependencies {
  implementation 'com.onesignal:core:5.0.0'
  implementation 'com.onesignal:notifications:5.0.0'
}

Build a release build / app bundle with proguard enabled

  1. Application crashes with error
    Service interface i6.a could not be instantiated

  2. App works as expected in debug mode

  3. Error disappears when all module dependencies are included

dependencies {
  implementation 'com.onesignal:core:5.0.0'
  implementation 'com.onesignal:in-app-messages:5.0.0'
  implementation 'com.onesignal:notifications:5.0.0'
  implementation 'com.onesignal:location:5.0.0'
}

or the full sdk package

dependencies {
  implementation 'com.onesignal:OneSignal:5.0.0'
}

What did you expect to happen?

As explained in the Migration Guide and since the modules In App and Location are not used by the app, I expected that a partial declaration of dependencies would be sufficient.

The issue resolves after depending on the whole OneSIgnal SDK, so I suspect something related to proguard rules or internal dependencies of the modules causes the inability to depend on the partial sdk.

OneSignal Android SDK version

5.1.1

Android version

13

Specific Android models

No response

Relevant log output

Two warnings before the crash helped pinpoint the issue to the missing modules:


 java.lang.ClassNotFoundException: com.onesignal.inAppMessages.InAppMessagesModule
2024-01-22 13:33:40.909 13210-13210 System.err                                               W  	at java.lang.Class.classForName(Native Method)
2024-01-22 13:33:40.909 13210-13210 System.err                                               W  	at java.lang.Class.forName(Class.java:454)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at java.lang.Class.forName(Class.java:379)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at com.onesignal.internal.a.<init>(Unknown Source:94)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at j5.b$a.a(Unknown Source:2)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at j5.b$a.invoke(Unknown Source:0)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at kotlin.SynchronizedLazyImpl.getValue(Unknown Source:20)
2024-01-22 13:33:40.909 13210-13210 System.err                                               W  	at j5.b.b(Unknown Source:2)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at j5.b.e(Unknown Source:12)
2024-01-22 13:33:40.909 13210-13210 System.err                                               W  	at xxx.onCreate(Unknown Source:80)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1277)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6759)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2133)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at android.os.Handler.dispatchMessage(Handler.java:106)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at android.os.Looper.loopOnce(Looper.java:201)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at android.os.Looper.loop(Looper.java:288)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at android.app.ActivityThread.main(ActivityThread.java:7872)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at java.lang.reflect.Method.invoke(Native Method)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  Caused by: java.lang.ClassNotFoundException: com.onesignal.inAppMessages.InAppMessagesModule
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	... 21 more
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  java.lang.ClassNotFoundException: com.onesignal.location.LocationModule
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at java.lang.Class.classForName(Native Method)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at java.lang.Class.forName(Class.java:454)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at java.lang.Class.forName(Class.java:379)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at com.onesignal.internal.a.<init>(Unknown Source:94)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at j5.b$a.a(Unknown Source:2)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at j5.b$a.invoke(Unknown Source:0)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at kotlin.SynchronizedLazyImpl.getValue(Unknown Source:20)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at j5.b.b(Unknown Source:2)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at j5.b.e(Unknown Source:12)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at xxx.onCreate(Unknown Source:80)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1277)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6759)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2133)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at android.os.Handler.dispatchMessage(Handler.java:106)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at android.os.Looper.loopOnce(Looper.java:201)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at android.os.Looper.loop(Looper.java:288)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at android.app.ActivityThread.main(ActivityThread.java:7872)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at java.lang.reflect.Method.invoke(Native Method)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  Caused by: java.lang.ClassNotFoundException: com.onesignal.location.LocationModule
2024-01-22 13:33:40.909 13210-13210 System.err                                                W  	... 21 more
2024-01-22 13:33:40.913 13210-13210 OneSignal                                                 W  [main] Service not found: interface i6.a

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jennantilla
Copy link
Contributor

@CarlBarks thank you for the detailed reproduction steps! We're looking into this more and will get back to you as soon as possible.

@sebastinto
Copy link

Also experiencing this when building a release build with R8 enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants