-
Notifications
You must be signed in to change notification settings - Fork 106
Description
Hi, I am experiencing a couple of issues after adding the BarcodeScanner.Mobile.Maui package to my project:
** Build Errors (Java Errors):**
MSBUILD : java.exe error JAVA0000: Error in obj\Debug\net8.0-android\lp\145\jl\classes.jar:androidx/activity/ActivityViewModelLazyKt$viewModels$1.class:
MSBUILD : java.exe error JAVA0000: Type androidx.activity.ActivityViewModelLazyKt$viewModels$1 is defined multiple times: obj\Debug\net8.0-android\lp\145\jl\classes.jar:androidx/activity/ActivityViewModelLazyKt$viewModels$1.class, obj\Debug\net8.0-android\lp\179\jl\classes.jar:androidx/activity/ActivityViewModelLazyKt$viewModels$1.class
The issue is resolved by adding the Xamarin.AndroidX.Fragment.Ktx package:
However, this approach seems to introduce other problems.
- Infinite Loop When Running Tests:
After resolving the build issue with Xamarin.AndroidX.Fragment.Ktx, the tests in my project are now running infinitely in a loop when executed.
I’ve tried debugging, but the tests never finish executing. I am not sure if this is caused by the AndroidX dependency conflict or if there is another underlying issue.
Environment:
- .NET MAUI version: .NET8
- BarcodeScanner.Mobile.Maui version: [version number]
- Xamarin.AndroidX.Fragment.Ktx version: 1.7.0.1
- Operating System: Windows
- IDE: Visual Studio
Steps to Reproduce:
Create a new .NET MAUI project.
Add the BarcodeScanner.Mobile.Maui package.
Build the project, encounter Java-related build errors.
Add Xamarin.AndroidX.Fragment.Ktx to resolve the build error.
Attempt to run tests – they start but run infinitely without completing.
Target Frameworks:
Main Project: net8.0-ios;net8.0-android;net8.0;
Test Project: net8.0
Expected Behavior:
- Successful build without Java errors after adding BarcodeScanner.Mobile.Maui.
- Tests should run and complete as expected.
Actual Behavior:
- Java build errors are resolved by adding Xamarin.AndroidX.Fragment.Ktx.
- Tests run infinitely without completing.
What I’ve Tried:
- Cleaned and rebuilt the project.
- Checked for dependency conflicts and tried updating/reinstalling packages.
- Checked for issues with the test project setup.
Additional Notes: I would appreciate guidance on resolving the infinite test loop issue and whether there is a recommended way to avoid using Xamarin.AndroidX.Fragment.Ktx or an alternative to prevent the dependency conflict.