Closed FetFrumos closed 3 years ago
It is not supporting yet. As you can see here, their original Android library still uses old Support libraries https://github.com/OneSignal/OneSignal-Android-SDK/blob/master/OneSignalSDK/onesignal/build.gradle
And this xamarin version is the wrapper of this android version.
@FetFrumos @EmilAlipiev You can add Xamarin.AndroidX.Migration
to your project if you have updated to AndroidX and need to use OneSignal. It allows for packages that are still using the "Android Support Library" to work with your project, like Jetifier does for Android Native projects. See their readme for more details.
https://github.com/xamarin/AndroidX/tree/master/source/migration
We will soon have a major release 4.0.0 version beta to try out for Xamarin where it will be updated to use AndroidX as well going forward so this won't always be required.
I have face the same issue, for me it's:
NU1107 Version conflict detected for Xamarin.Android.Support.Annotations. Install/reference Xamarin.Android.Support.Annotations 28.0.0.3 directly to project KApp.Android to resolve this issue.
KApp.Android -> Xamarin.Forms.Maps 4.8.0.1687 -> Xamarin.Android.Support.v4 28.0.0.3 -> Xamarin.Android.Support.Media.Compat 28.0.0.3 -> Xamarin.Android.Support.Annotations (= 28.0.0.3)
KApp.Android -> KApp-> Com.OneSignal 3.10.2 -> Xamarin.Android.Support.v7.CardView 26.0.2 -> Xamarin.Android.Support.Annotations (= 26.0.2). KApp.Android
So what i have to do now is waiting for the new version or using AndroidX Migration? Is it correct ?
@jkasten2
We will soon have a major release 4.0.0 version beta to try out for Xamarin where it will be updated to use AndroidX as well going forward so this won't always be required.
Soon means? Can you provide an estimated delivery time for the new version? A month, a year or something?
I wait in anticipation for this 4.0.0 beta... Seems pretty important as Google Play now requires apps be built with at least Android SDK API 29 now.
Still no word on this or commits towards it?
Has anyone gotten OneSignal and AndroidX to work?
Any update on this issue?
A timeline would be good please.
Howdy, Thanks everyone for your patience.
We are working hard to get out the next major release version. In the meantime, please see this comment for a workaround.
We don't have a set timeline, though in order to manage expectations this won't be released on the order of weeks but rather months more likely.
Please try the above proposed solution. If it works for you or have anything to add that could help others, any comments would be greatly appreciated. If it doesn't work for you, also let us know with information related to your app environment.
Cheers
@rgomezp I don't think the proposed solution has worked for anyone.
Even with the Migration library, it is just a countless cycle of these errors, especially on phone reboots:
java.lang.InstantiationException: java.lang.Class<com.google.firebase.iid.FirebaseInstanceIdService> cannot be instantiated
and
java.lang.InstantiationException: java.lang.Class<com.onesignal.RestoreKickoffJobService> cannot be instantiated
and
java.lang.InstantiationException: java.lang.Class<com.onesignal.RestoreJobService> cannot be instantiated
These are hard app crashes for anyone on an Android 10, 11, or 12 device... with or without the Android X migration library. It does not happen in debug mode, only in Release mode or when actually deployed to a physical device.
It worked for me!
@alexthekid07 Its not working for me too. I have tried but still facing the issue. https://github.com/OneSignal/OneSignal-Xamarin-SDK/issues/230
This solution works for me. Please check this comment. https://github.com/OneSignal/OneSignal-Xamarin-SDK/issues/228#issuecomment-813979825
We just released Com.OneSignal 3.10.5 with dependency changes to resolve the AndroidX compatibility. Simply upgrade to this version and rebuild your project.
Don't forget to include a proguard configuration when using R8. I was facing the exact same issue because OneSignal was not declared to be excepted in the proguard.cfg. Here is my working config:
-dontwarn com.google.android.gms. -keep class com.google.firebase.provider.FirebaseInitProvider -keep class com.google.firebase.iid.FirebaseInstanceIdReceiver -keep class com.google.firebase.messaging.FirebaseMessagingService -keep class com.onesignal. { *; } -keep class com.google.firebase.* { ; }
We just released Com.OneSignal 3.10.5 with dependency changes to resolve the AndroidX compatibility. Simply upgrade to this version and rebuild your project.
I still got this error with Com.OneSignal Version="3.10.6"
until i added the migration nuget that solved the issue.
@taublast Not sure why it didn't pull that in as a dependency for you but good to hear that fixed it for you.
Also wanted to note in OneSignal-Xamarin-SDK 4.0.0 this is no longer required for OneSignal at least, since it now uses AndroidX instead of Android Support.
I using OneSignal(3.10.1) in my Xamarin Forms app. I have problem with android. I use some package I use several packages that need Android X. This is:
-BarcodeScanner.XF -Xam.Plugins.Android.ExoPlayer
But OneSignal using CompileSdkVersion - Android 9(Api Level 28). When I try install OneSignal in android project(for Android 10) than I get this error:
So for the single packages I need Android X for the other ones - Android 9(CompileSdkVersion). How do I solve this problem and is it possible?