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]: OneSignalSDK.DotNet is not compatible with Xamarin.GooglePlayServices #123

Open
1 task done
kablammyman opened this issue Oct 9, 2024 · 2 comments
Open
1 task done

Comments

@kablammyman
Copy link

What happened?

I have OneSignalSDK.DotNet version 5.2.1 and I use it well. I have tried over the last few months to add in admob banner to my .net mai app. I have tried plugins to do this as well as trying to implement it by hand, but it always gives the same result, failure to build the android version of the app. I have the latest version of visual studio and im using .net 8.0.403.

I have also tried this with a brand new test project that only has the 2 onesignal nuget package and the Xamarin.GooglePlayServices.Ads package.

Here is the meat of the error:

MSBUILD : java.exe error JAVA0000: Error in C:\Users\kabla.nuget\packages\xamarin.androidx.collection.jvm\1.4.4\buildTransitive\net8.0-android34.0....\jar\androidx.collection.collection-jvm.jar:androidx/collection/ArrayMapKt.class:
1>MSBUILD : java.exe error JAVA0000: Type androidx.collection.ArrayMapKt is defined multiple times: C:\Users\kabla.nuget\packages\xamarin.androidx.collection.jvm\1.4.4\buildTransitive\net8.0-android34.0....\jar\androidx.collection.collection-jvm.jar:androidx/collection/ArrayMapKt.class, C:\Users\kabla.nuget\packages\xamarin.androidx.collection.ktx\1.2.0.9\buildTransitive\net6.0-android31.0....\jar\androidx.collection.collection-ktx.jar:androidx/collection/ArrayMapKt.class
1>MSBUILD : java.exe error JAVA0000: Compilation failed

If you look at the project.assets.json file, you will see this:
"OneSignalSDK.DotNet/5.2.1": {
"type": "package",
"dependencies": {
"Xamarin.AndroidX.AppCompat": "1.4.2.1",
"Xamarin.AndroidX.Browser": "1.4.0.2",
"Xamarin.AndroidX.CardView": "1.0.0.16",
"Xamarin.AndroidX.Legacy.Support.V4": "1.0.0.14",
"Xamarin.AndroidX.Work.Runtime": "2.7.1.5",
"Xamarin.AndroidX.Work.Work.Runtime.Ktx": "2.7.1.5",
"Xamarin.Firebase.Messaging": "123.0.8",
"Xamarin.Google.Dagger": "2.41.0.2",
"Xamarin.GooglePlayServices.Base": "118.1.0",
"Xamarin.Kotlin.StdLib.Jdk8": "1.8.0.1",
"Xamarin.KotlinX.Coroutines.Android": "1.6.4.2",
"Xamarin.KotlinX.Coroutines.Core": "1.6.4.2"
}

notice the: "Xamarin.AndroidX.Work.Work.Runtime.Ktx": "2.7.1.5" even if you have the updated version of any of the "Xamarin.AndroidX.*" libs, OneSignalSDK will continue to try to use this older version.

Steps to reproduce?

1) create a new .net maui project
2) add the OneSignalSDK.DotNet nuget package
3) add the Xamarin.GooglePlayServices.Ads package
4) build the android version
5) notice the failure to build after code compilation

What did you expect to happen?

the app builds and one signal can use the updated version of the Xarmarin.AndroidX libs

Relevant log output

Build started at 12:05 PM...
1>------ Build started: Project: AdmobAndOneSignalTest, Configuration: Debug Any CPU ------
1>D:\source\AdmobAndOneSignalTest\AdmobAndOneSignalTest.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.LiveData 2.8.5.1 requires Xamarin.AndroidX.Lifecycle.LiveData.Core (>= 2.8.5.1 && < 2.8.6) but version Xamarin.AndroidX.Lifecycle.LiveData.Core 2.8.6 was resolved.
1>D:\source\AdmobAndOneSignalTest\AdmobAndOneSignalTest.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.Service 2.8.5.1 requires Xamarin.AndroidX.Lifecycle.Runtime (>= 2.8.5.1 && < 2.8.6) but version Xamarin.AndroidX.Lifecycle.Runtime 2.8.6 was resolved.
1>D:\source\AdmobAndOneSignalTest\AdmobAndOneSignalTest.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.ViewModelSavedState 2.8.5.1 requires Xamarin.AndroidX.Lifecycle.LiveData.Core (>= 2.8.5.1 && < 2.8.6) but version Xamarin.AndroidX.Lifecycle.LiveData.Core 2.8.6 was resolved.
1>D:\source\AdmobAndOneSignalTest\AdmobAndOneSignalTest.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.LiveData.Core.Ktx 2.8.5.1 requires Xamarin.AndroidX.Lifecycle.LiveData.Core (>= 2.8.5.1 && < 2.8.6) but version Xamarin.AndroidX.Lifecycle.LiveData.Core 2.8.6 was resolved.
1>Skipping analyzers to speed up the build. You can execute 'Build' or 'Rebuild' command to run analyzers.
1>AdmobAndOneSignalTest -> D:\source\AdmobAndOneSignalTest\bin\Debug\net8.0-android\AdmobAndOneSignalTest.dll
1>D:\source\AdmobAndOneSignalTest\AdmobAndOneSignalTest.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.LiveData 2.8.5.1 requires Xamarin.AndroidX.Lifecycle.LiveData.Core (>= 2.8.5.1 && < 2.8.6) but version Xamarin.AndroidX.Lifecycle.LiveData.Core 2.8.6 was resolved.
1>D:\source\AdmobAndOneSignalTest\AdmobAndOneSignalTest.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.Service 2.8.5.1 requires Xamarin.AndroidX.Lifecycle.Runtime (>= 2.8.5.1 && < 2.8.6) but version Xamarin.AndroidX.Lifecycle.Runtime 2.8.6 was resolved.
1>D:\source\AdmobAndOneSignalTest\AdmobAndOneSignalTest.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.ViewModelSavedState 2.8.5.1 requires Xamarin.AndroidX.Lifecycle.LiveData.Core (>= 2.8.5.1 && < 2.8.6) but version Xamarin.AndroidX.Lifecycle.LiveData.Core 2.8.6 was resolved.
1>D:\source\AdmobAndOneSignalTest\AdmobAndOneSignalTest.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.LiveData.Core.Ktx 2.8.5.1 requires Xamarin.AndroidX.Lifecycle.LiveData.Core (>= 2.8.5.1 && < 2.8.6) but version Xamarin.AndroidX.Lifecycle.LiveData.Core 2.8.6 was resolved.
1>Done building project "AdmobAndOneSignalTest.csproj".
1>MSBUILD : java.exe error JAVA0000: Error in C:\Users\kabla\.nuget\packages\xamarin.androidx.collection.jvm\1.4.4\buildTransitive\net8.0-android34.0\..\..\jar\androidx.collection.collection-jvm.jar:androidx/collection/ArrayMapKt.class:
1>MSBUILD : java.exe error JAVA0000: Type androidx.collection.ArrayMapKt is defined multiple times: C:\Users\kabla\.nuget\packages\xamarin.androidx.collection.jvm\1.4.4\buildTransitive\net8.0-android34.0\..\..\jar\androidx.collection.collection-jvm.jar:androidx/collection/ArrayMapKt.class, C:\Users\kabla\.nuget\packages\xamarin.androidx.collection.ktx\1.2.0.9\buildTransitive\net6.0-android31.0\..\..\jar\androidx.collection.collection-ktx.jar:androidx/collection/ArrayMapKt.class
1>MSBUILD : java.exe error JAVA0000: Compilation failed
1>MSBUILD : java.exe error JAVA0000: java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: C:\Users\kabla\.nuget\packages\xamarin.androidx.collection.jvm\1.4.4\buildTransitive\net8.0-android34.0\..\..\jar\androidx.collection.collection-jvm.jar
1>MSBUILD : java.exe error JAVA0000: androidx/collection/ArrayMapKt.class
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:135)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.D8.main(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:5)
1>MSBUILD : java.exe error JAVA0000: Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: C:\Users\kabla\.nuget\packages\xamarin.androidx.collection.jvm\1.4.4\buildTransitive\net8.0-android34.0\..\..\jar\androidx.collection.collection-jvm.jar:androidx/collection/ArrayMapKt.class
1>MSBUILD : java.exe error JAVA0000: 	at Version.fakeStackEntry(Version_8.2.33.java:0)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.T.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:5)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:82)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:32)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:31)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.utils.S0.b(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:2)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.D8.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:42)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.D8.b(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:13)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.D8.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:40)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:122)
1>MSBUILD : java.exe error JAVA0000: 	... 1 more
1>MSBUILD : java.exe error JAVA0000: Caused by: com.android.tools.r8.utils.b: Type androidx.collection.ArrayMapKt is defined multiple times: C:\Users\kabla\.nuget\packages\xamarin.androidx.collection.jvm\1.4.4\buildTransitive\net8.0-android34.0\..\..\jar\androidx.collection.collection-jvm.jar:androidx/collection/ArrayMapKt.class, C:\Users\kabla\.nuget\packages\xamarin.androidx.collection.ktx\1.2.0.9\buildTransitive\net6.0-android31.0\..\..\jar\androidx.collection.collection-ktx.jar:androidx/collection/ArrayMapKt.class
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.utils.Q2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:21)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.utils.D2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:54)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.utils.D2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:10)
1>MSBUILD : java.exe error JAVA0000: 	at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2056)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.utils.D2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:6)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.graph.m4$a.d(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:6)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.dex.c.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:61)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.dex.c.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:12)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.dex.c.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:9)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.D8.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:45)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.D8.d(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:17)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.D8.c(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:69)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:28)
1>MSBUILD : java.exe error JAVA0000: 	... 6 more
1>MSBUILD : java.exe error JAVA0000:
1>Done building project "AdmobAndOneSignalTest.csproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 12:05 PM and took 46.728 seconds ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========
========== Deploy completed at 12:05 PM and took 46.728 seconds ==========

Code of Conduct

  • I agree to follow this project's Code of Conduct
@bnoffer
Copy link

bnoffer commented Oct 10, 2024

There is a current issue with the AndroidX components that will be addressed as part of .NET 9 in combination with R8/Proguard. You need to configure your proguard.cfg in a certain way, check this post for details: #89 (comment) , your issue might be related to that.

@nan-li
Copy link

nan-li commented Nov 1, 2024

Hi @kablammyman thank you for reporting. Did the suggestion from @bnoffer resolve your issue?

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

3 participants