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

InnovacationTargetException #2146

Closed
Asalerm opened this issue Jul 15, 2024 · 9 comments
Closed

InnovacationTargetException #2146

Asalerm opened this issue Jul 15, 2024 · 9 comments

Comments

@Asalerm
Copy link

Asalerm commented Jul 15, 2024

This the error I get when trying to .initwithContext().

@jinliu9508
Copy link
Contributor

Hello @Asalerm, could you provide more info like a stack trace, SDK version, build environment, and details on how you were calling .initWithContext()?

@Asalerm
Copy link
Author

Asalerm commented Jul 15, 2024

Hello @Asalerm, could you provide more info like a stack trace, SDK version, build environment, and details on how you were calling .initWithContext()?

I am using SDK version 5.0.0

@Asalerm
Copy link
Author

Asalerm commented Jul 15, 2024

@jinliu9508 and when I changed it to 5.1.8 my build crashes

@jkasten2
Copy link
Member

@Asalerm please try out the latest SDK, 5.1.17. If you continue to see this error please provide the full stack trace.

@RK-AndroidDev
Copy link

Here is the latest stack trace for InvocationTargetException

Fatal Exception: java.lang.reflect.InvocationTargetException:
at java.lang.reflect.Constructor.newInstance0(Constructor.java)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at com.onesignal.common.services.ServiceRegistrationReflection.resolve(ServiceRegistration.kt:88)
at com.onesignal.common.services.ServiceProvider.getServiceOrNull(ServiceProvider.kt:79)
at com.onesignal.common.services.ServiceProvider.getService(ServiceProvider.kt:67)
at com.onesignal.common.services.ServiceRegistrationReflection.resolve(ServiceRegistration.kt:81)
at com.onesignal.common.services.ServiceProvider.getServiceOrNull(ServiceProvider.kt:79)
at com.onesignal.common.services.ServiceProvider.getService(ServiceProvider.kt:67)
at com.onesignal.common.services.ServiceRegistrationReflection.resolve(ServiceRegistration.kt:81)
at com.onesignal.common.services.ServiceProvider.getServiceOrNull(ServiceProvider.kt:79)
at com.onesignal.common.services.ServiceProvider.getService(ServiceProvider.kt:67)
at com.onesignal.common.services.ServiceRegistrationReflection.resolve(ServiceRegistration.kt:81)
at com.onesignal.common.services.ServiceProvider.getAllServices(ServiceProvider.kt:55)
at com.onesignal.common.services.ServiceRegistrationReflection.resolve(ServiceRegistration.kt:71)
at com.onesignal.common.services.ServiceProvider.getAllServices(ServiceProvider.kt:55)
at com.onesignal.common.services.ServiceProvider.getAllServices$com_onesignal_core(ServiceProvider.kt:31)
at com.onesignal.core.internal.startup.StartupService$scheduleStart$1.invokeSuspend(StartupService.kt:20)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)

Caused by java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
at android.os.Handler.(Handler.java:203)
at android.os.Handler.(Handler.java:117)
at android.app.Activity.(Activity.java:837)
at com.onesignal.core.internal.permissions.impl.RequestPermissionService.(RequestPermissionService.kt:13)
at java.lang.reflect.Constructor.newInstance0(Constructor.java)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at com.onesignal.common.services.ServiceRegistrationReflection.resolve(ServiceRegistration.kt:88)
at com.onesignal.common.services.ServiceProvider.getServiceOrNull(ServiceProvider.kt:79)
at com.onesignal.common.services.ServiceProvider.getService(ServiceProvider.kt:67)
at com.onesignal.common.services.ServiceRegistrationReflection.resolve(ServiceRegistration.kt:81)
at com.onesignal.common.services.ServiceProvider.getServiceOrNull(ServiceProvider.kt:79)
at com.onesignal.common.services.ServiceProvider.getService(ServiceProvider.kt:67)
at com.onesignal.common.services.ServiceRegistrationReflection.resolve(ServiceRegistration.kt:81)
at com.onesignal.common.services.ServiceProvider.getServiceOrNull(ServiceProvider.kt:79)
at com.onesignal.common.services.ServiceProvider.getService(ServiceProvider.kt:67)
at com.onesignal.common.services.ServiceRegistrationReflection.resolve(ServiceRegistration.kt:81)
at com.onesignal.common.services.ServiceProvider.getAllServices(ServiceProvider.kt:55)
at com.onesignal.common.services.ServiceRegistrationReflection.resolve(ServiceRegistration.kt:71)
at com.onesignal.common.services.ServiceProvider.getAllServices(ServiceProvider.kt:55)
at com.onesignal.common.services.ServiceProvider.getAllServices$com_onesignal_core(ServiceProvider.kt:31)
at com.onesignal.core.internal.startup.StartupService$scheduleStart$1.invokeSuspend(StartupService.kt:20)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)

@Asalerm
Copy link
Author

Asalerm commented Jul 16, 2024

from jnius import autoclass

Accessing necessary Android classes

PythonActivity = autoclass('org.kivy.android.PythonActivity')
OneSignal = autoclass('com.onesignal.OneSignal')

Get the current Android activity

activity = PythonActivity.mActivity

OneSignal.initWithContext(activity, "my_app_id")

OneSignal.setLogLevel(OneSignal.LOG_LEVEL.VERBOSE, OneSignal.LOG_LEVEL.NONE)

Request notification permissions (optional)

OneSignal.Notifications.requestPermission()

I am using version 5.1.8

The error i get: InnovacationTargetException.

@jkasten2
Copy link
Member

@RK-AndroidDev based on the stack trace it looks like you are running OneSignal-Android-SDK 5.1.16 which is know to have this bug. Please update to 5.1.17.

@jkasten2
Copy link
Member

@Asalerm could you please try updating to 5.1.17?

Could you provide the full stack trace of the crash?

@jinliu9508
Copy link
Contributor

Closing this issue as it has been resolved in the latest SDK version, and there are no further updates. If anyone is still experiencing this issue, please try upgrading to the latest SDK and open a new issue if the problem persists after upgrading.

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

4 participants