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]: ClassNotFoundException: java.util.function.Consumer #758

Closed
1 task done
sntahmaz opened this issue Sep 9, 2024 · 1 comment
Closed
1 task done

[Bug]: ClassNotFoundException: java.util.function.Consumer #758

sntahmaz opened this issue Sep 9, 2024 · 1 comment

Comments

@sntahmaz
Copy link

sntahmaz commented Sep 9, 2024

What happened?

OneSignal causes class not found exception on Android 6 and earlier versions.
crash_session_stacktrace.txt

Steps to reproduce?

I couldn't reproduce but I have Crashlytics logs.

What did you expect to happen?

I expect OneSignal to work without exception on Android devices with API levels between 19 and 23.

Unity version

2021.3.43

OneSignal Unity SDK version

5.1.6

Platform

Android

Relevant log output

Fatal Exception: java.lang.Exception: AndroidJavaException : java.lang.ClassNotFoundException: java.util.function.Consumer
       at java.lang.Class.classForName(java.lang.Class)
       at java.lang.Class.forName(java.lang.Class)
       at com.unity3d.player.UnityPlayer.nativeRender(com.unity3d.player.UnityPlayer)
       at com.unity3d.player.UnityPlayer.access$300(com.unity3d.player.UnityPlayer)
       at com.unity3d.player.UnityPlayer$e$1.handleMessage(com.unity3d.player.UnityPlayer$e$1)
       at android.os.Handler.dispatchMessage(android.os.Handler)
       at android.os.Looper.loop(android.os.Looper)
       at com.unity3d.player.UnityPlayer$e.run(com.unity3d.player.UnityPlayer$e)
       at dalvik.system.BaseDexClassLoader.findClass(dalvik.system.BaseDexClassLoader)
       at java.lang.ClassLoader.loadClass(java.lang.ClassLoader)
       at java.lang.ClassLoader.loadClass(java.lang.ClassLoader)
       at java.lang.Class.classForName(java.lang.Class)
       at java.lang.BootClassLoader.findClass(java.lang.BootClassLoader)
       at java.lang.BootClassLoader.loadClass(java.lang.BootClassLoader)
       at java.lang.ClassLoader.loadClass(java.lang.ClassLoader)
       at UnityEngine.AndroidJNISafe.CheckException(UnityEngine.AndroidJNISafe)
       at UnityEngine.AndroidJNISafe.FindClass(UnityEngine.AndroidJNISafe)
       at UnityEngine.AndroidJavaClass._AndroidJavaClass(UnityEngine.AndroidJavaClass)
       at UnityEngine.AndroidJavaProxy..ctor(UnityEngine.AndroidJavaProxy.)
       at OneSignalSDK.Android.Utilities.BoolContinuation..ctor(OneSignalSDK.Android.Utilities.BoolContinuation.)
       at OneSignalSDK.Android.Notifications.AndroidNotificationsManager+<RequestPermissionAsync>d__17.MoveNext(OneSignalSDK.Android.Notifications.AndroidNotificationsManager+<RequestPermissionAsync>d__17)
       at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[TResult].Start[TStateMachine](System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[TResult])
       at OneSignalSDK.Android.Notifications.AndroidNotificationsManager.RequestPermissionAsync(OneSignalSDK.Android.Notifications.AndroidNotificationsManager)
       at PushNotificationManager+<PromtForNotificationIfRequired>d__11.MoveNext(PushNotificationManager+<PromtForNotificationIfRequired>d__11)
       at System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Start[TStateMachine](System.Runtime.CompilerServices.AsyncVoidMethodBuilder)
       at PushNotificationManager.PromtForNotificationIfRequired(PushNotificationManager)
       at SceneControllers.MainSceneController.Start(SceneControllers.MainSceneController)

Code of Conduct

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

Apologies for the delayed response

Our Android SDK only supports Android 5+ and unfortunately, there is no straightforward workaround to support the java.util.function.Consumer class in Unity for Android 5 and Android 6. We will be updating our docs to bump the minimum Android version for the OneSignal Unity SDK from Android 5 to Android 7.

Closing this issue for now. If you would like to discuss further, feel free to respond here

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

No branches or pull requests

2 participants