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]: Could not create Worker com.onesignal.notifications.internal.restoration.impl.NotificationRestoreWorkManager$NotificationRestoreWorker #1677

Closed
1 of 3 tasks
CristianCosmicVspartners opened this issue Apr 2, 2024 · 6 comments

Comments

@CristianCosmicVspartners
Copy link

CristianCosmicVspartners commented Apr 2, 2024

What happened?

After the upgrade from v4 to v5 I am getting the Native Android error and receive no push.

Steps to reproduce?

-Upgrade from V4 to 5.1.0 or any other 5.x.x version
-Install on Android device (Pixel 6a) Android 14
-Check Android studio Logcat, Error in Logs
-This is happening on both Dev and release env

-Send notifications from Onesignal web page
-No notification is received

What did you expect to happen?

Receive push notifications

React Native OneSignal SDK version

5.1.0

Which platform(s) are affected?

  • iOS
  • Android

Relevant log output

E  Could not instantiate com.onesignal.notifications.internal.restoration.impl.NotificationRestoreWorkManager$NotificationRestoreWorker
                                                                                                    java.lang.reflect.InvocationTargetException
                                                                                                    	
at java.lang.reflect.Constructor.newInstance0(Native Method)
                                                                                                    	
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
                                                                                                    	
at androidx.work.WorkerFactory.createWorkerWithDefaultFallback(WorkerFactory.java:96)
                                                                                                    	
at androidx.work.impl.WorkerWrapper.runWorker(WorkerWrapper.java:245)
                                                                                                    	
at androidx.work.impl.WorkerWrapper.run(WorkerWrapper.java:137)
                                                                                                    	
at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:91)
                                                                                                    	
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
                                                                                                    	
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
                                                                                                    	
at java.lang.Thread.run(Thread.java:1012)
                                                                                                    
Caused by: java.lang.NoSuchMethodError: No interface method getSerialTaskExecutor()Landroidx/work/impl/utils/taskexecutor/SerialExecutor; in class Landroidx/work/impl/utils/taskexecutor/TaskExecutor; or its super classes (declaration of 'androidx.work.impl.utils.taskexecutor.TaskExecutor' appears in /data/app/~~XnyUvZgb8t81pTzkfIuC7w==/com.modalview.mobile-W2G51nXkC85bBURFlotYAQ==/base.apk!classes18.dex)
                                                                                                    	
at androidx.work.CoroutineWorker.<init>(CoroutineWorker.kt:53)
                                                                                                    	
at com.onesignal.notifications.internal.restoration.impl.NotificationRestoreWorkManager$NotificationRestoreWorker.<init>(NotificationRestoreWorkManager.kt:47)
                                                                                                    	
at java.lang.reflect.Constructor.newInstance0(Native Method) 
                                                                                                    	
at java.lang.reflect.Constructor.newInstance(Constructor.java:343) 
                                                                                                    	
at androidx.work.WorkerFactory.createWorkerWithDefaultFallback(WorkerFactory.java:96) 
                                                                                                    	

at androidx.work.impl.WorkerWrapper.runWorker(WorkerWrapper.java:245) 
                                                                                                    	
at androidx.work.impl.WorkerWrapper.run(WorkerWrapper.java:137) 
                                                                                                    	
at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:91)

Code of Conduct

  • I agree to follow this project's Code of Conduct
@CristianCosmicVspartners CristianCosmicVspartners changed the title [Bug]: Could not create Worker com.onesignal.notifications.internal.restoration.impl.NotificationRestoreWorkManager$NotificationRestoreWorker [Bug]: Could not create Worker com.onesignal.notifications.internal.restoration.impl.NotificationRestoreWorkManager$NotificationRestoreWorker Apr 2, 2024
@laurentiupopavs
Copy link

I am having the same error. Did you find anything?

@CristianCosmicVspartners
Copy link
Author

Can any one please take a look at this and advise ?

@nan-li
Copy link
Contributor

nan-li commented Apr 22, 2024

Hi @CristianCosmicVspartners thank you for reporting. Are you experiencing this Could not instantiate.. all the time or only sometimes?

@jkasten2
Copy link
Member

jkasten2 commented Jul 18, 2024

I am able to reproduce the issue if work-runtime-ktx:2.8.1 is used with androidx.work:work-runtime:2.7.0 in a forceful way, such as:

    implementation('androidx.work:work-runtime-ktx:2.8.1')
    api('androidx.work:work-runtime') {
        version {
            strictly '2.7.0'
        }
    }

However it isn't clear what's downgrading the version in your scenario, but finding that is the key to solving this.

Can you run ./gradlew app:dependencies or ./gradlew build --scan from the android folder of your project. (where your build.gradle or gradlew files are located) and share the output? This should point to what library is defining a force downgrade.

Another way to find the breaking library is if you remove libraries from your project, or make a new project and build them up and share the project reproducing the issue.

@bricezele
Copy link

Hello, I have the same issue on Android

@jennantilla
Copy link
Contributor

Hello everyone--it appears this issue has become a bit stale.

This comment provides some additional context and troubleshooting steps.

If this is still a problem for anyone, please let us know and we can discuss further.

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

6 participants