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

.NET MAUI8 project does not compile with BarcodeScanner.Mobile Version 8.0.40.1 NuGet package #245

Open
Timonysos opened this issue Jun 28, 2024 · 9 comments
Labels
bug Something isn't working

Comments

@Timonysos
Copy link

I added the NuGet package BarcodeScanner.Mobile Version 8.0.40.1 to an empty .NET MAUI8 project and it won't compile.

There are a lot of related issus like #218 and #223.
I tried multiple fixes but it seems like I wasn't quiet able to figure out which packages I need to add.

These are my packages I use:

<ItemGroup>
	<PackageReference Include="BarcodeScanner.Mobile.Maui" Version="8.0.40.1" />
	<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.61" />
	<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.61" />
	<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
</ItemGroup>

I got the following errors:

java.exe error JAVA0000: Error in obj\Debug\net8.0-android\lp\136\jl\classes.jar:androidx/activity/ActivityViewModelLazyKt$viewModels$1.class:
java.exe error JAVA0000: Type androidx.activity.ActivityViewModelLazyKt$viewModels$1 is defined multiple times: obj\Debug\net8.0-android\lp\136\jl\classes.jar:androidx/activity/ActivityViewModelLazyKt$viewModels$1.class, obj\Debug\net8.0-android\lp\170\jl\classes.jar:androidx/activity/ActivityViewModelLazyKt$viewModels$1.class
java.exe error JAVA0000: Compilation failed
java.exe error JAVA0000: java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: obj\Debug\net8.0-android\lp\136\jl\classes.jar
java.exe error JAVA0000: androidx/activity/ActivityViewModelLazyKt$viewModels$1.class
java.exe error JAVA0000: 	at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:135)
java.exe error JAVA0000: 	at com.android.tools.r8.D8.main(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:5)
java.exe error JAVA0000: Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: obj\Debug\net8.0-android\lp\136\jl\classes.jar:androidx/activity/ActivityViewModelLazyKt$viewModels$1.class
java.exe error JAVA0000: 	at Version.fakeStackEntry(Version_8.2.33.java:0)
java.exe error JAVA0000: 	at com.android.tools.r8.T.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:5)
java.exe error JAVA0000: 	at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:82)
java.exe error JAVA0000: 	at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:32)
java.exe error JAVA0000: 	at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:31)
java.exe error JAVA0000: 	at com.android.tools.r8.utils.S0.b(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:2)
java.exe error JAVA0000: 	at com.android.tools.r8.D8.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:42)
java.exe error JAVA0000: 	at com.android.tools.r8.D8.b(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:13)
java.exe error JAVA0000: 	at com.android.tools.r8.D8.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:40)
java.exe error JAVA0000: 	at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:122)
java.exe error JAVA0000: 	... 1 more
java.exe error JAVA0000: Caused by: com.android.tools.r8.utils.b: Type androidx.activity.ActivityViewModelLazyKt$viewModels$1 is defined multiple times: obj\Debug\net8.0-android\lp\136\jl\classes.jar:androidx/activity/ActivityViewModelLazyKt$viewModels$1.class, obj\Debug\net8.0-android\lp\170\jl\classes.jar:androidx/activity/ActivityViewModelLazyKt$viewModels$1.class
java.exe error JAVA0000: 	at com.android.tools.r8.utils.Q2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:21)
java.exe error JAVA0000: 	at com.android.tools.r8.utils.D2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:54)
java.exe error JAVA0000: 	at com.android.tools.r8.utils.D2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:10)
java.exe error JAVA0000: 	at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2056)
java.exe error JAVA0000: 	at com.android.tools.r8.utils.D2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:6)
java.exe error JAVA0000: 	at com.android.tools.r8.graph.m4$a.d(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:6)
java.exe error JAVA0000: 	at com.android.tools.r8.dex.c.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:61)
java.exe error JAVA0000: 	at com.android.tools.r8.dex.c.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:12)
java.exe error JAVA0000: 	at com.android.tools.r8.dex.c.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:9)
java.exe error JAVA0000: 	at com.android.tools.r8.D8.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:45)
java.exe error JAVA0000: 	at com.android.tools.r8.D8.d(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:17)
java.exe error JAVA0000: 	at com.android.tools.r8.D8.c(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:69)
java.exe error JAVA0000: 	at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:28)
java.exe error JAVA0000: 	... 6 more
java.exe error JAVA0000: Directory 'obj\Debug\net8.0-android\lp\136' is from 'androidx.activity.activity.aar'.
@Timonysos Timonysos added the bug Something isn't working label Jun 28, 2024
@JimmyPun610
Copy link
Owner

Hi,
Could you try downgrade the MAUI version to 8.0.41 and try rebuild?
It might be caused by different version using in the library and MAUI. If this is the case, I will try to create a new version to use 8.0.61

@Timonysos
Copy link
Author

Hi, Could you try downgrade the MAUI version to 8.0.41 and try rebuild? It might be caused by different version using in the library and MAUI. If this is the case, I will try to create a new version to use 8.0.61

I tried downgrading to MAUI version 8.0.40 but still got the same error.

<ItemGroup>
	<PackageReference Include="BarcodeScanner.Mobile.Maui" Version="8.0.40.1" />
	<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.40" />
	<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.40" />
	<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
</ItemGroup>

@bengavin
Copy link
Contributor

bengavin commented Jul 1, 2024

@Timonysos - Have you tried this set of Android-specific includes:

#240 (comment)

@Timonysos
Copy link
Author

@Timonysos - Have you tried this set of Android-specific includes:

#240 (comment)

Yes, I tried this set of includes but I didn't work for me.

@oleg-varlamov
Copy link

Hello! We have the same issue after upgrading our app from MAUI 7 to MAUI 8

@stepkillah
Copy link
Contributor

including the latest version of Xamarin.AndroidX.Activity worked for me

@dalevross
Copy link

@stepkillah What version on Xamarin.AndroidX.Activity was that?

@15mgm15
Copy link

15mgm15 commented Oct 24, 2024

@dalevross Did you manage to solve this?

@alejandro7x
Copy link

Any news on this error? We are in the process of migrating an application from Xamarin Forms to MAUI, and we haven't been able to make the switch because this library is a fundamental part of the application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants