InnovacationTargetException
This the error I get when trying to .initwithContext().
Hello @Asalerm, could you provide more info like a stack trace, SDK version, build environment, and details on how you were calling .initWithContext()?
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
@jinliu9508 and when I changed it to 5.1.8 my build crashes
@Asalerm please try out the latest SDK, 5.1.17. If you continue to see this error please provide the full stack trace.
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.
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.
@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.
@Asalerm could you please try updating to 5.1.17?
Could you provide the full stack trace of the crash?
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.