maui icon indicating copy to clipboard operation
maui copied to clipboard

Android ecosystem updates based on net9.0 branch

Open moljac opened this issue 1 year ago • 6 comments

Description of Change

Updated Android packages and Maven related artifacts.

PR based on net9.0 branch

This PR is in favour of https://github.com/dotnet/maui/pull/23117 for simplicity (after changing base branch additional commits were added)

moljac avatar Jun 26 '24 11:06 moljac

/azp run

moljac avatar Jun 27 '24 16:06 moljac

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Jun 27 '24 16:06 azure-pipelines[bot]

Errors

E memtrack: Couldn't load memtrack module (No such file or directory)
E android.os.Debug: failed to load memtrack module: -2
E GmsClient: unable to connect to service: com.google.android.gms.auth.key.retrieval.service.START on com.google.android.gms

moljac avatar Jun 27 '24 16:06 moljac

Notes

suspicious: Core.DeviceTests-DEBUG-ios.binlog

tree Android\ emulator\ tests\ Core_API_23\ \(attempt\ 1\)
Android emulator tests Core_API_23 (attempt 1)
├── logs
│   ├── Core.DeviceTests-DEBUG-ios.binlog
│   ├── Microsoft.Maui.BuildTasks-Release-Build-dotnet-133638760394201480.binlog
│   ├── dotnet-Release-133638758886055130.binlog
│   └── dotnet-Release-133638760369155880.binlog
└── test-results
    ├── TestResultsFailures
    │   ├── 982d6419-b046-4ce4-9780-377a2ff1cce8
    │   │   └── adb-logcat-com.microsoft.maui.core.devicetests-com.microsoft.maui.core.devicetests.TestInstrumentation.log
    │   └── d02c6e50-0f7a-40aa-9c75-0f2fe82c89f2
    │       └── adb-logcat-com.microsoft.maui.core.devicetests-com.microsoft.maui.core.devicetests.TestInstrumentation.log
    └── adb-logcat-com.microsoft.maui.core.devicetests-com.microsoft.maui.core.devicetests.TestInstrumentation.log
tree Android\ emulator\ tests\ Core_API_23\ \(attempt\ 2\) 
Android emulator tests Core_API_23 (attempt 2)
├── logs
│   ├── Core.DeviceTests-DEBUG-ios.binlog
│   ├── Microsoft.Maui.BuildTasks-Release-Build-dotnet-133638931660421920.binlog
│   ├── dotnet-Release-133638930096604450.binlog
│   └── dotnet-Release-133638931635182360.binlog
└── test-results
    ├── TestResultsFailures
    │   ├── a3a96d50-4362-4834-921d-3a2c06d30c9b
    │   │   └── adb-logcat-com.microsoft.maui.core.devicetests-com.microsoft.maui.core.devicetests.TestInstrumentation.log
    │   └── b5a65cc3-0f61-41d2-9d3b-b39a681f422c
    │       └── adb-logcat-com.microsoft.maui.core.devicetests-com.microsoft.maui.core.devicetests.TestInstrumentation.log
    └── adb-logcat-com.microsoft.maui.core.devicetests-com.microsoft.maui.core.devicetests.TestInstrumentation.log

moljac avatar Jun 27 '24 16:06 moljac

/azp run

moljac avatar Jun 28 '24 06:06 moljac

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Jun 28 '24 06:06 azure-pipelines[bot]

/azp run

moljac avatar Jul 08 '24 21:07 moljac

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Jul 08 '24 21:07 azure-pipelines[bot]

Package import triggered (new dependencies)

Xamarin.AndroidX.Lifecycle.Common.Jvm
Xamarin.KotlinX.AtomicFU

moljac avatar Jul 09 '24 08:07 moljac

/azp run

moljac avatar Jul 09 '24 08:07 moljac

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Jul 09 '24 08:07 azure-pipelines[bot]

very old package

Xam.Plugin.DeviceInfo

./src/Compatibility/ControlGallery/src/Android/Compatibility.ControlGallery.Android.csproj

<PackageReference Include="Xam.Plugin.DeviceInfo" Version="4.1.1" />

moljac avatar Jul 09 '24 09:07 moljac



    ./src/Core/src/Core.csproj : error NU1107: 
      Version conflict detected for Xamarin.AndroidX.Lifecycle.Common. Install/reference Xamarin.AndroidX.Lifecycle.Common 2.8.3 directly to project Microsoft.Maui.Core to resolve this issue. 
       Microsoft.Maui.Core -> Xamarin.AndroidX.Lifecycle.LiveData 2.8.3 -> Xamarin.AndroidX.Lifecycle.LiveData.Core 2.8.3 -> Xamarin.AndroidX.Lifecycle.Common (>= 2.8.3 && < 2.8.4) 
       Microsoft.Maui.Core -> Xamarin.Google.Android.Material 1.11.0 -> Xamarin.AndroidX.Lifecycle.Runtime 2.7.0.4 -> Xamarin.AndroidX.Lifecycle.Common (>= 2.7.0.4 && < 2.7.1).
    ./src/Controls/src/Xaml/Controls.Xaml.csproj : error NU1107: 
      Version conflict detected for Xamarin.AndroidX.Lifecycle.Common. Install/reference Xamarin.AndroidX.Lifecycle.Common 2.8.3 directly to project Microsoft.Maui.Controls.Xaml to resolve this issue. 
       Microsoft.Maui.Controls.Xaml -> Microsoft.Maui.Core -> Xamarin.AndroidX.Lifecycle.LiveData 2.8.3 -> Xamarin.AndroidX.Lifecycle.LiveData.Core 2.8.3 -> Xamarin.AndroidX.Lifecycle.Common (>= 2.8.3 && < 2.8.4) 
       Microsoft.Maui.Controls.Xaml -> Microsoft.Maui.Core -> Xamarin.Google.Android.Material 1.11.0 -> Xamarin.AndroidX.Lifecycle.Runtime 2.7.0.4 -> Xamarin.AndroidX.Lifecycle.Common (>= 2.7.0.4 && < 2.7.1).
    ./src/Controls/src/Core/Controls.Core.csproj : error NU1107: 
      Version conflict detected for Xamarin.AndroidX.Lifecycle.Common. Install/reference Xamarin.AndroidX.Lifecycle.Common 2.8.3 directly to project Microsoft.Maui.Controls.Core to resolve this issue. 
       Microsoft.Maui.Controls.Core -> Microsoft.Maui.Core -> Xamarin.AndroidX.Lifecycle.LiveData 2.8.3 -> Xamarin.AndroidX.Lifecycle.LiveData.Core 2.8.3 -> Xamarin.AndroidX.Lifecycle.Common (>= 2.8.3 && < 2.8.4) 
       Microsoft.Maui.Controls.Core -> Microsoft.Maui.Core -> Xamarin.Google.Android.Material 1.11.0 -> Xamarin.AndroidX.Lifecycle.Runtime 2.7.0.4 -> Xamarin.AndroidX.Lifecycle.Common (>= 2.7.0.4 && < 2.7.1).

moljac avatar Jul 10 '24 15:07 moljac

    ./src/Controls/src/Xaml/Controls.Xaml.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.Runtime 2.7.0.4 requires Xamarin.AndroidX.Lifecycle.Common (>= 2.7.0.4 && < 2.7.1) but version Xamarin.AndroidX.Lifecycle.Common 2.8.3 was resolved.
    ./src/Core/src/Core.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.Runtime 2.7.0.4 requires Xamarin.AndroidX.Lifecycle.Common (>= 2.7.0.4 && < 2.7.1) but version Xamarin.AndroidX.Lifecycle.Common 2.8.3 was resolved.
    ./src/Controls/src/Core/Controls.Core.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.Runtime 2.7.0.4 requires Xamarin.AndroidX.Lifecycle.Common (>= 2.7.0.4 && < 2.7.1) but version Xamarin.AndroidX.Lifecycle.Common 2.8.3 was resolved.
    ./src/Controls/src/Core/Controls.Core.csproj : error NU1107: 
      Version conflict detected for Xamarin.AndroidX.Lifecycle.LiveData.Core. Install/reference Xamarin.AndroidX.Lifecycle.LiveData.Core 2.8.3 directly to project Microsoft.Maui.Controls.Core to resolve this issue. 
       Microsoft.Maui.Controls.Core -> Microsoft.Maui.Core -> Xamarin.AndroidX.Lifecycle.LiveData 2.8.3 -> Xamarin.AndroidX.Lifecycle.LiveData.Core (>= 2.8.3 && < 2.8.4) 
       Microsoft.Maui.Controls.Core -> Microsoft.Maui.Core -> Xamarin.AndroidX.Navigation.Common 2.7.7.4 -> Xamarin.AndroidX.Lifecycle.ViewModelSavedState 2.7.0.4 -> Xamarin.AndroidX.Lifecycle.LiveData.Core (>= 2.7.0.4 && < 2.7.1).
    ./src/Core/src/Core.csproj : error NU1107: 
      Version conflict detected for Xamarin.AndroidX.Lifecycle.LiveData.Core. Install/reference Xamarin.AndroidX.Lifecycle.LiveData.Core 2.8.3 directly to project Microsoft.Maui.Core to resolve this issue. 
       Microsoft.Maui.Core -> Xamarin.AndroidX.Lifecycle.LiveData 2.8.3 -> Xamarin.AndroidX.Lifecycle.LiveData.Core (>= 2.8.3 && < 2.8.4) 
       Microsoft.Maui.Core -> Xamarin.AndroidX.Navigation.Common 2.7.7.4 -> Xamarin.AndroidX.Lifecycle.ViewModelSavedState 2.7.0.4 -> Xamarin.AndroidX.Lifecycle.LiveData.Core (>= 2.7.0.4 && < 2.7.1).
    ./src/Controls/src/Xaml/Controls.Xaml.csproj : error NU1107: 
      Version conflict detected for Xamarin.AndroidX.Lifecycle.LiveData.Core. Install/reference Xamarin.AndroidX.Lifecycle.LiveData.Core 2.8.3 directly to project Microsoft.Maui.Controls.Xaml to resolve this issue. 
       Microsoft.Maui.Controls.Xaml -> Microsoft.Maui.Core -> Xamarin.AndroidX.Lifecycle.LiveData 2.8.3 -> Xamarin.AndroidX.Lifecycle.LiveData.Core (>= 2.8.3 && < 2.8.4) 
       Microsoft.Maui.Controls.Xaml -> Microsoft.Maui.Core -> Xamarin.AndroidX.Navigation.Common 2.7.7.4 -> Xamarin.AndroidX.Lifecycle.ViewModelSavedState 2.7.0.4 -> Xamarin.AndroidX.Lifecycle.LiveData.Core (>= 2.7.0.4 && < 2.7.1).

moljac avatar Jul 11 '24 21:07 moljac

========================================
dotnet
========================================
Restore complete (9,7s)
  DotNet                                                                                       _InstallDotNet (1226,4s)
                                                                                                              (1226,7s)
                                                                                                              (1226,9s)
                                                                                                              (1227,7s)
                                                                                                              (1227,9s)
                                                                                                              (1228,1s)
                                                                                                              (1228,3s)
  DotNet failed with 4 error(s) (2670,1s)
    curl : (22) The requested URL returned error : 404
    dotnet_install : error : Could not find `.NET Core SDK` with version = 9.0.100-preview.5.24304.3
    dotnet_install : error : Refer to: https://aka.ms/dotnet-os-lifecycle for information on .NET Core support
    ./src/DotNet/DotNet.csproj(131,5): error MSB3073: The command "bash './bin/dotnet-install.sh' --version 9.0.100-preview.5.24304.3 --install-dir './bin/dotnet/' --verbose --azure-feed https://dotnetbuilds.blob.core.windows.net/public" exited with code 1.

Build failed with 4 error(s) in 2698,5s
An error occurred when executing task 'dotnet'.
Error: .NET CLI: Process returned an error (exit code 1).

moljac avatar Jul 11 '24 21:07 moljac

Can you merge or rebase against the net9.0 branch? They are on .NET 9 Preview 7 now, and your error says Preview 5.

jonathanpeppers avatar Jul 11 '24 21:07 jonathanpeppers

Can you merge or rebase against the net9.0 branch? They are on .NET 9 Preview 7 now, and your error says Preview 5.

I grabbed Versions.props from net9.0 and did some tests locally. I did not push yet.

Now I get

   Resources/values/styles.xml(2): error APT2260: 
      resource attr/colorPrimary (aka Microsoft.Maui:attr/colorPrimary) not found.
      
    Resources/values/styles.xml(2): error APT2260: 
      resource attr/actionBarSize (aka Microsoft.Maui:attr/actionBarSize) not found.
      
    Resources/values/styles.xml(2): error APT2260: 
      resource attr/colorPrimary (aka Microsoft.Maui:attr/colorPrimary) not found.
      
    Resources/values/styles.xml(2): error APT2260: 
      resource attr/actionBarSize (aka Microsoft.Maui:attr/actionBarSize) not found.
      
    Resources/values/styles.xml(2): error APT2260: 
      resource style/ThemeOverlay.AppCompat.Dark.ActionBar (aka Microsoft.Maui:style/ThemeOverlay.AppCompat.Dark.ActionBar) not found.
      
    Resources/values/styles.xml(2): error APT2260: 
      resource style/Widget.Design.BottomNavigationView (aka Microsoft.Maui:style/Widget.Design.BottomNavigationView) not found.
      
    /usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/34.99.0-preview.5.308/tools/Xamarin.Android.Aapt2.targets(156,3): error APT2260: 
      resource style/Theme.MaterialComponents.DayNight (aka Microsoft.Maui:style/Theme.MaterialComponents.DayNight) not found.
      
    Resources/values/styles.xml(2): error APT2260: 
      style attribute 'attr/alertDialogTheme (aka Microsoft.Maui:attr/alertDialogTheme)' not found.
      
    Resources/values/styles.xml(2): error APT2260: 
      resource style/ThemeOverlay.AppCompat.Dark.ActionBar (aka Microsoft.Maui:style/ThemeOverlay.AppCompat.Dark.ActionBar) not found.
      
    Resources/values/styles.xml(2): error APT2260: 
      resource style/Widget.Design.BottomNavigationView (aka Microsoft.Maui:style/Widget.Design.BottomNavigationView) not found.
      
    Resources/values/styles.xml(2): error APT2260: 
      style attribute 'attr/checkboxStyle (aka Microsoft.Maui:attr/checkboxStyle)' not found.
      
    Resources/values/styles.xml(2): error APT2260: 
      style attribute 'attr/colorAccent (aka Microsoft.Maui:attr/colorAccent)' not found.
      
    Resources/values/styles.xml(2): error APT2260: 
      style attribute 'attr/colorPrimary (aka Microsoft.Maui:attr/colorPrimary)' not found.
      
    Resources/values/styles.xml(2): error APT2260: 
      style attribute 'attr/colorPrimaryDark (aka Microsoft.Maui:attr/colorPrimaryDark)' not found.
      
    Resources/values/styles.xml(2): error APT2260: 
      style attribute 'attr/materialButtonStyle (aka Microsoft.Maui:attr/materialButtonStyle)' not found.
      
    Resources/values/styles.xml(2): error APT2260: 
      resource attr/colorPrimary (aka Microsoft.Maui:attr/colorPrimary) not found.
      
    Resources/values/styles.xml(2): error APT2260: 
      style attribute 'attr/windowActionBar (aka Microsoft.Maui:attr/windowActionBar)' not found.
      
    Resources/values/styles.xml(2): error APT2260: 
      style attribute 'attr/windowActionModeOverlay (aka Microsoft.Maui:attr/windowActionModeOverlay)' not found.
      
    Resources/values/styles.xml(2): error APT2260: 
      style attribute 'attr/windowNoTitle (aka Microsoft.Maui:attr/windowNoTitle)' not found.
      
    Resources/values/styles.xml(2): error APT2260: 
      resource attr/colorPrimary (aka Microsoft.Maui:attr/colorPrimary) not found.

I think it is from src/Core/AndroidNative/, but not sure. Checking...

Edit:

yup that was it.

========================================
android-aar
========================================
Starting a Gradle Daemon (subsequent builds will be faster)

> Task :maui:processReleaseManifest
package="com.microsoft.maui" found in source AndroidManifest.xml: ./src/Core/AndroidNative/maui/src/main/AndroidManifest.xml.
Setting the namespace via a source AndroidManifest.xml's package attribute is deprecated.
Please instead set the namespace (or testNamespace) in the module's build.gradle file, as described here: https://developer.android.com/studio/build/configure-app-module#set-namespace
This migration can be done automatically using the AGP Upgrade Assistant, please refer to https://developer.android.com/studio/build/agp-upgrade-assistant for more information.

> Task :maui:compileReleaseJavaWithJavac
Note: [1] Wrote GeneratedAppGlideModule with: []
Note: ./src/Core/AndroidNative/maui/src/main/java/com/microsoft/maui/PlatformInterop.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

> Task :maui:verifyReleaseResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':maui:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action
   > Android resource linking failed
     ERROR:./src/Core/AndroidNative/maui/build/intermediates/merged_res/release/values-v34/values-v34.xml:3: AAPT: error: resource android:color/system_background_dark not found.
         
     ERROR:./src/Core/AndroidNative/maui/build/intermediates/merged_res/release/values-v34/values-v34.xml:4: AAPT: error: resource android:color/system_error_dark not found.
         
     ERROR:./src/Core/AndroidNative/maui/build/intermediates/merged_res/release/values-v34/values-v34.xml:5: AAPT: error: resource android:color/system_error_container_dark not found.
         
     ERROR:./src/Core/AndroidNative/maui/build/intermediates/merged_res/release/values-v34/values-v34.xml:6: AAPT: error: resource android:color/system_on_surface_light not found.
         
     ERROR:./src/Core/AndroidNative/maui/build/intermediates/merged_res/release/values-v34/values-v34.xml:7: AAPT: error: resource android:color/system_primary_light not found.
         
     ERROR:./src/Core/AndroidNative/maui/build/intermediates/merged_res/release/values-v34/values-v34.xml:8: AAPT: error: resource android:color/system_surface_light not found.
         
     ERROR:./src/Core/AndroidNative/maui/build/intermediates/merged_res/release/values-v34/values-v34.xml:9: AAPT: error: resource android:color/system_on_background_dark not found.
         
     ERROR:./src/Core/AndroidNative/maui/build/intermediates/merged_res/release/values-v34/values-v34.xml:10: AAPT: error: resource android:color/system_on_error_dark not found.
         
     ERROR:./src/Core/AndroidNative/maui/build/intermediates/merged_res/release/values-v34/values-v34.xml:11: AAPT: error: resource android:color/system_on_error_container_dark not found.
         
     ERROR:./src/Core/AndroidNative/maui/build/intermediates/merged_res/release/values-v34/values-v34.xml:12: AAPT: error: resource android:color/system_on_primary_dark not found.
         
     ERROR:./src/Core/AndroidNative/maui/build/intermediates/merged_res/release/values-v34/values-v34.xml:13: AAPT: error: resource android:color/system_on_primary_container_dark not found.
         
     ERROR:./src/Core/AndroidNative/maui/build/intermediates/merged_res/release/values-v34/values-v34.xml:14: AAPT: error: resource android:color/system_on_secondary_dark not found.
         
     ERROR:./src/Core/AndroidNative/maui/build/intermediates/merged_res/release/values-v34/values-v34.xml:15: AAPT: error: resource android:color/system_on_secondary_container_dark not found.
         
     ERROR:./src/Core/AndroidNative/maui/build/intermediates/merged_res/release/values-v34/values-v34.xml:16: AAPT: error: resource android:color/system_on_surface_dark not found.
         
     ERROR:./src/Core/AndroidNative/maui/build/intermediates/merged_res/release/values-v34/values-v34.xml:17: AAPT: error: resource android:color/system_on_surface_variant_dark not found.
         
     ERROR:./src/Core/AndroidNative/maui/build/intermediates/merged_res/release/values-v34/values-v34.xml:18: AAPT: error: resource android:color/system_on_tertiary_dark not found.
         
     ERROR:./src/Core/AndroidNative/maui/build/intermediates/merged_res/release/values-v34/values-v34.xml:19: AAPT: error: resource android:color/system_on_tertiary_container_dark not found.
         
     ERROR:./src/Core/AndroidNative/maui/build/intermediates/merged_res/release/values-v34/values-v34.xml:20: AAPT: error: resource android:color/system_outline_dark not found.
         
     ERROR:./src/Core/AndroidNative/maui/build/intermediates/merged_res/release/values-v34/values-v34.xml:21: AAPT: error: resource android:color/system_outline_variant_dark not found.
         
     ERROR:./src/Core/AndroidNative/maui/build/intermediates/merged_res/release/values-v34/values-v34.xml:22: AAPT: error: resource android:color/system_primary_dark not found.
         

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2m 31s
26 actionable tasks: 25 executed, 1 up-to-date
This task failing locally will not break local MAUI development. Gradle failed to build maui.aar: 1

moljac avatar Jul 12 '24 09:07 moljac

I was able to solve problem above by changing:

compileSdk 31

to:

compileSdk 34

in src/Core/AndroidNative/maui/build.gradle

moljac avatar Jul 12 '24 09:07 moljac

Local build green

Pushing

moljac avatar Jul 12 '24 09:07 moljac

CI errors Android emulator tests Core_API_33

========================================
build
========================================
  Determining projects to restore...
/Users/builder/azdo/_work/1/s/src/Controls/src/Core/Controls.Core.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.Runtime 2.7.0.4 requires Xamarin.AndroidX.Lifecycle.Common (>= 2.7.0.4 && < 2.7.1) but version Xamarin.AndroidX.Lifecycle.Common 2.8.3 was resolved. [/Users/builder/azdo/_work/1/s/src/Core/tests/DeviceTests/Core.DeviceTests.csproj]
/Users/builder/azdo/_work/1/s/src/Core/src/Core.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.Runtime 2.7.0.4 requires Xamarin.AndroidX.Lifecycle.Common (>= 2.7.0.4 && < 2.7.1) but version Xamarin.AndroidX.Lifecycle.Common 2.8.3 was resolved. [/Users/builder/azdo/_work/1/s/src/Core/tests/DeviceTests/Core.DeviceTests.csproj]
/Users/builder/azdo/_work/1/s/src/Controls/src/Xaml/Controls.Xaml.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.Runtime.Ktx 2.7.0.4 requires Xamarin.AndroidX.Lifecycle.Runtime (>= 2.7.0.4 && < 2.7.1) but version Xamarin.AndroidX.Lifecycle.Runtime 2.8.3 was resolved. [/Users/builder/azdo/_work/1/s/src/Core/tests/DeviceTests/Core.DeviceTests.csproj]
/Users/builder/azdo/_work/1/s/src/Core/src/Core.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.ViewModelSavedState 2.7.0.4 requires Xamarin.AndroidX.Lifecycle.LiveData.Core (>= 2.7.0.4 && < 2.7.1) but version Xamarin.AndroidX.Lifecycle.LiveData.Core 2.8.3 was resolved. [/Users/builder/azdo/_work/1/s/src/Core/tests/DeviceTests/Core.DeviceTests.csproj]
/Users/builder/azdo/_work/1/s/src/Controls/src/Xaml/Controls.Xaml.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.ViewModel.Ktx 2.7.0.4 requires Xamarin.AndroidX.Lifecycle.ViewModel (>= 2.7.0.4 && < 2.7.1) but version Xamarin.AndroidX.Lifecycle.ViewModel 2.8.3 was resolved. [/Users/builder/azdo/_work/1/s/src/Core/tests/DeviceTests/Core.DeviceTests.csproj]
/Users/builder/azdo/_work/1/s/src/Controls/src/Core/Controls.Core.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.ViewModelSavedState 2.7.0.4 requires Xamarin.AndroidX.Lifecycle.LiveData.Core (>= 2.7.0.4 && < 2.7.1) but version Xamarin.AndroidX.Lifecycle.LiveData.Core 2.8.3 was resolved. [/Users/builder/azdo/_work/1/s/src/Core/tests/DeviceTests/Core.DeviceTests.csproj]
/Users/builder/azdo/_work/1/s/src/Controls/src/Xaml/Controls.Xaml.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.Process 2.7.0.4 requires Xamarin.AndroidX.Lifecycle.Runtime (>= 2.7.0.4 && < 2.7.1) but version Xamarin.AndroidX.Lifecycle.Runtime 2.8.3 was resolved. [/Users/builder/azdo/_work/1/s/src/Core/tests/DeviceTests/Core.DeviceTests.csproj]
  Restored /Users/builder/azdo/_work/1/s/src/TestUtils/src/DeviceTests.Runners.SourceGen/TestUtils.DeviceTests.Runners.SourceGen.csproj (in 1.63 sec).
/Users/builder/azdo/_work/1/s/src/TestUtils/src/DeviceTests/TestUtils.DeviceTests.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.ViewModelSavedState 2.7.0.4 requires Xamarin.AndroidX.Lifecycle.LiveData.Core (>= 2.7.0.4 && < 2.7.1) but version Xamarin.AndroidX.Lifecycle.LiveData.Core 2.8.3 was resolved. [/Users/builder/azdo/_work/1/s/src/Core/tests/DeviceTests/Core.DeviceTests.csproj]
/Users/builder/azdo/_work/1/s/src/TestUtils/src/DeviceTests/TestUtils.DeviceTests.csproj : error NU1107: Version conflict detected for Xamarin.AndroidX.Lifecycle.Common. Install/reference Xamarin.AndroidX.Lifecycle.Common 2.8.3 directly to project Microsoft.Maui.TestUtils.DeviceTests to resolve this issue.  [/Users/builder/azdo/_work/1/s/src/Core/tests/DeviceTests/Core.DeviceTests.csproj]
/Users/builder/azdo/_work/1/s/src/TestUtils/src/DeviceTests/TestUtils.DeviceTests.csproj : error NU1107:  Microsoft.Maui.TestUtils.DeviceTests -> Microsoft.Maui.Core -> Xamarin.AndroidX.Lifecycle.Common (>= 2.8.3)  [/Users/builder/azdo/_work/1/s/src/Core/tests/DeviceTests/Core.DeviceTests.csproj]
/Users/builder/azdo/_work/1/s/src/TestUtils/src/DeviceTests/TestUtils.DeviceTests.csproj : error NU1107:  Microsoft.Maui.TestUtils.DeviceTests -> Microsoft.Maui.Essentials -> Xamarin.AndroidX.Browser 1.8.0.3 -> Xamarin.AndroidX.Core 1.13.1.2 -> Xamarin.AndroidX.Lifecycle.Runtime 2.7.0.4 -> Xamarin.AndroidX.Lifecycle.Common (>= 2.7.0.4 && < 2.7.1). [/Users/builder/azdo/_work/1/s/src/Core/tests/DeviceTests/Core.DeviceTests.csproj]
  Failed to restore /Users/builder/azdo/_work/1/s/src/TestUtils/src/DeviceTests/TestUtils.DeviceTests.csproj (in 2.6 sec).
/Users/builder/azdo/_work/1/s/src/Core/tests/DeviceTests.Shared/Core.DeviceTests.Shared.csproj : error NU1107: Version conflict detected for Xamarin.AndroidX.Lifecycle.Runtime. Install/reference Xamarin.AndroidX.Lifecycle.Runtime 2.8.3 directly to project Microsoft.Maui.DeviceTests.Shared to resolve this issue.  [/Users/builder/azdo/_work/1/s/src/Core/tests/DeviceTests/Core.DeviceTests.csproj]
/Users/builder/azdo/_work/1/s/src/Core/tests/DeviceTests.Shared/Core.DeviceTests.Shared.csproj : error NU1107:  Microsoft.Maui.DeviceTests.Shared -> Microsoft.Maui.Controls.Xaml -> Xamarin.AndroidX.Lifecycle.Runtime (>= 2.8.3)  [/Users/builder/azdo/_work/1/s/src/Core/tests/DeviceTests/Core.DeviceTests.csproj]
/Users/builder/azdo/_work/1/s/src/Core/tests/DeviceTests.Shared/Core.DeviceTests.Shared.csproj : error NU1107:  Microsoft.Maui.DeviceTests.Shared -> Microsoft.Maui.Core -> Xamarin.AndroidX.Navigation.Runtime 2.7.7.4 -> Xamarin.AndroidX.Lifecycle.Runtime.Ktx 2.7.0.4 -> Xamarin.AndroidX.Lifecycle.Runtime (>= 2.7.0.4 && < 2.7.1). [/Users/builder/azdo/_work/1/s/src/Core/tests/DeviceTests/Core.DeviceTests.csproj]
/Users/builder/azdo/_work/1/s/src/TestUtils/src/DeviceTests.Runners/TestUtils.DeviceTests.Runners.csproj : error NU1107: Version conflict detected for Xamarin.AndroidX.Lifecycle.Runtime. Install/reference Xamarin.AndroidX.Lifecycle.Runtime 2.8.3 directly to project Microsoft.Maui.TestUtils.DeviceTests.Runners to resolve this issue.  [/Users/builder/azdo/_work/1/s/src/Core/tests/DeviceTests/Core.DeviceTests.csproj]
/Users/builder/azdo/_work/1/s/src/TestUtils/src/DeviceTests.Runners/TestUtils.DeviceTests.Runners.csproj : error NU1107:  Microsoft.Maui.TestUtils.DeviceTests.Runners -> Microsoft.Maui.Controls.Xaml -> Xamarin.AndroidX.Lifecycle.Runtime (>= 2.8.3)  [/Users/builder/azdo/_work/1/s/src/Core/tests/DeviceTests/Core.DeviceTests.csproj]
/Users/builder/azdo/_work/1/s/src/TestUtils/src/DeviceTests.Runners/TestUtils.DeviceTests.Runners.csproj : error NU1107:  Microsoft.Maui.TestUtils.DeviceTests.Runners -> Microsoft.Maui.Core -> Xamarin.AndroidX.Navigation.Runtime 2.7.7.4 -> Xamarin.AndroidX.Lifecycle.Runtime.Ktx 2.7.0.4 -> Xamarin.AndroidX.Lifecycle.Runtime (>= 2.7.0.4 && < 2.7.1). [/Users/builder/azdo/_work/1/s/src/Core/tests/DeviceTests/Core.DeviceTests.csproj]
  Failed to restore /Users/builder/azdo/_work/1/s/src/Core/tests/DeviceTests.Shared/Core.DeviceTests.Shared.csproj (in 6.88 sec).
  Failed to restore /Users/builder/azdo/_work/1/s/src/TestUtils/src/DeviceTests.Runners/TestUtils.DeviceTests.Runners.csproj (in 6.91 sec).
/Users/builder/azdo/_work/1/s/src/Core/tests/DeviceTests/Core.DeviceTests.csproj : error NU1107: Version conflict detected for Xamarin.AndroidX.Lifecycle.Runtime. Install/reference Xamarin.AndroidX.Lifecycle.Runtime 2.8.3 directly to project Microsoft.Maui.Core.DeviceTests to resolve this issue. 
/Users/builder/azdo/_work/1/s/src/Core/tests/DeviceTests/Core.DeviceTests.csproj : error NU1107:  Microsoft.Maui.Core.DeviceTests -> Microsoft.Maui.DeviceTests.Shared -> Microsoft.Maui.Controls.Xaml -> Xamarin.AndroidX.Lifecycle.Runtime (>= 2.8.3) 
/Users/builder/azdo/_work/1/s/src/Core/tests/DeviceTests/Core.DeviceTests.csproj : error NU1107:  Microsoft.Maui.Core.DeviceTests -> Microsoft.Maui.Core -> Xamarin.AndroidX.Navigation.Runtime 2.7.7.4 -> Xamarin.AndroidX.Lifecycle.Runtime.Ktx 2.7.0.4 -> Xamarin.AndroidX.Lifecycle.Runtime (>= 2.7.0.4 && < 2.7.1).
  Failed to restore /Users/builder/azdo/_work/1/s/src/Core/tests/DeviceTests/Core.DeviceTests.csproj (in 7.89 sec).
  6 of 11 projects are up-to-date for restore.
An error occurred when executing task 'build'.

Adding

  <ItemGroup Condition="$(TargetFramework.Contains('-android'))">
    <PackageReference Include="Xamarin.AndroidX.Lifecycle.Common" Version="2.8.3" />
    <PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData.Core" Version="2.8.3" />
  </ItemGroup>

to src/Core/tests/DeviceTests/Core.DeviceTests.csproj

moljac avatar Jul 12 '24 10:07 moljac

Is there a plan to reflect this change to 8.0?

maonaoda avatar Jul 29 '24 08:07 maonaoda

Is there a plan to reflect this change to 8.0?

It started as PR targeting main (net8.0), but due to some limitations targeting branch was changed.

moljac avatar Jul 29 '24 13:07 moljac

New problem

There seems to be a problem here https://android.googlesource.com/platform/frameworks/support/+/refs/heads/androidx-master-dev/viewpager2/viewpager2/src/main/java/androidx/viewpager2/adapter/FragmentStateAdapter.java#447

I/MonoDroid: UNHANDLED EXCEPTION:
I/MonoDroid: Java.Lang.ClassCastException: crc6452ffdc5b34af3a0f.WrapperView cannot be cast to android.widget.FrameLayout
I/MonoDroid:
I/MonoDroid:   --- End of managed Java.Lang.ClassCastException stack trace ---
I/MonoDroid: java.lang.ClassCastException: crc6452ffdc5b34af3a0f.WrapperView cannot be cast to android.widget.FrameLayout
I/MonoDroid:  at androidx.viewpager2.adapter.FragmentStateAdapter.removeFragment(FragmentStateAdapter.java:447)
I/MonoDroid:  at androidx.viewpager2.adapter.FragmentStateAdapter.onViewRecycled(FragmentStateAdapter.java:414)
I/MonoDroid:  at androidx.viewpager2.adapter.FragmentStateAdapter.onViewRecycled(FragmentStateAdapter.java:73)
I/MonoDroid:  at androidx.recyclerview.widget.RecyclerView$Recycler.dispatchViewRecycled(RecyclerView.java:7415)
I/MonoDroid:  at androidx.recyclerview.widget.RecyclerView$Recycler.addViewHolderToRecycledViewPool(RecyclerView.java:7177)
I/MonoDroid:  at androidx.recyclerview.widget.RecyclerView$Recycler.recycleViewHolderInternal(RecyclerView.java:7128)
I/MonoDroid:  at androidx.recyclerview.widget.RecyclerView.removeAnimatingView(RecyclerView.java:1597)
I/MonoDroid:  at androidx.recyclerview.widget.RecyclerView$ItemAnimatorRestoreListener.onAnimationFinished(RecyclerView.java:13655)
I/MonoDroid:  at androidx.recyclerview.widget.RecyclerView$ItemAnimator.dispatchAnimationFinished(RecyclerView.java:14157)
I/MonoDroid:  at androidx.recyclerview.widget.SimpleItemAnimator.dispatchRemoveFinished(SimpleItemAnimator.java:286)
I/MonoDroid:  at androidx.recyclerview.widget.DefaultItemAnimator$4.onAnimationEnd(DefaultItemAnimator.java:216)
I/MonoDroid:  at android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationEnd(ViewPropertyAnimator.java:1115)
I/MonoDroid:  at android.animation.Animator$AnimatorListener.onAnimationEnd(Animator.java:711)
I/MonoDroid:  at android.animation.Animator$AnimatorCaller$$ExternalSyntheticLambda1.call(Unknown Source:4)
I/MonoDroid:  at android.animation.Animator.callOnList(Animator.java:669)
I/MonoDroid:  at android.animation.Animator.notifyListeners(Animator.java:608)
I/MonoDroid:  at android.animation.Animator.notifyEndListeners(Animator.java:633)
I/MonoDroid:  at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1306)
I/MonoDroid:  at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1566)
I/MonoDroid:  at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:328)
I/MonoDroid:  at android.animation.AnimationHandler.-$$Nest$mdoAnimationFrame(Unknown Source:0)
I/MonoDroid:  at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:86)
I/MonoDroid:  at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1337)
I/MonoDroid:  at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1348)
I/MonoDroid:  at android.view.Choreographer.doCallbacks(Choreographer.java:952)
I/MonoDroid:  at android.view.Choreographer.doFrame(Choreographer.java:878)
I/MonoDroid:  at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1322)
I/MonoDroid:  at android.os.Handler.handleCallback(Handler.java:958)
I/MonoDroid:  at android.os.Handler.dispatchMessage(Handler.java:99)
I/MonoDroid:  at android.os.Looper.loopOnce(Looper.java:205)
I/MonoDroid:  at android.os.Looper.loop(Looper.java:294)
I/MonoDroid:  at android.app.ActivityThread.main(ActivityThread.java:8177)
I/MonoDroid:  at java.lang.reflect.Method.invoke(Native Method)
I/MonoDroid:  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
I/MonoDroid:  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
I/MonoDroid:
I/MonoDroid:   --- End of managed Java.Lang.ClassCastException stack trace ---
I/MonoDroid: java.lang.ClassCastException: crc6452ffdc5b34af3a0f.WrapperView cannot be cast to android.widget.FrameLayout
I/MonoDroid:  at androidx.viewpager2.adapter.FragmentStateAdapter.removeFragment(FragmentStateAdapter.java:447)
I/MonoDroid:  at androidx.viewpager2.adapter.FragmentStateAdapter.onViewRecycled(FragmentStateAdapter.java:414)
I/MonoDroid:  at androidx.viewpager2.adapter.FragmentStateAdapter.onViewRecycled(FragmentStateAdapter.java:73)
I/MonoDroid:  at androidx.recyclerview.widget.RecyclerView$Recycler.dispatchViewRecycled(RecyclerView.java:7415)
I/MonoDroid:  at androidx.recyclerview.widget.RecyclerView$Recycler.addViewHolderToRecycledViewPool(RecyclerView.java:7177)
I/MonoDroid:  at androidx.recyclerview.widget.RecyclerView$Recycler.recycleViewHolderInternal(RecyclerView.java:7128)
I/MonoDroid:  at androidx.recyclerview.widget.RecyclerView.removeAnimatingView(RecyclerView.java:1597)
I/MonoDroid:  at androidx.recyclerview.widget.RecyclerView$ItemAnimatorRestoreListener.onAnimationFinished(RecyclerView.java:13655)
I/MonoDroid:  at androidx.recyclerview.widget.RecyclerView$ItemAnimator.dispatchAnimationFinished(RecyclerView.java:14157)
I/MonoDroid:  at androidx.recyclerview.widget.SimpleItemAnimator.dispatchRemoveFinished(SimpleItemAnimator.java:286)
I/MonoDroid:  at androidx.recyclerview.widget.DefaultItemAnimator$4.onAnimationEnd(DefaultItemAnimator.java:216)
I/MonoDroid:  at android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationEnd(ViewPropertyAnimator.java:1115)
I/MonoDroid:  at android.animation.Animator$AnimatorListener.onAnimationEnd(Animator.java:711)
I/MonoDroid:  at android.animation.Animator$AnimatorCaller$$ExternalSyntheticLambda1.call(Unknown Source:4)
I/MonoDroid:  at android.animation.Animator.callOnList(Animator.java:669)
I/MonoDroid:  at android.animation.Animator.notifyListeners(Animator.java:608)
I/MonoDroid:  at android.animation.Animator.notifyEndListeners(Animator.java:633)
I/MonoDroid:  at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1306)
I/MonoDroid:  at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1566)
I/MonoDroid:  at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:328)
I/MonoDroid:  at android.animation.AnimationHandler.-$$Nest$mdoAnimationFrame(Unknown Source:0)
I/MonoDroid:  at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:86)
I/MonoDroid:  at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1337)
I/MonoDroid:  at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1348)
I/MonoDroid:  at android.view.Choreographer.doCallbacks(Choreographer.java:952)
I/MonoDroid:  at android.view.Choreographer.doFrame(Choreographer.java:878)
I/MonoDroid:  at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1322)
I/MonoDroid:  at android.os.Handler.handleCallback(Handler.java:958)
I/MonoDroid:  at android.os.Handler.dispatchMessage(Handler.java:99)
I/MonoDroid:  at android.os.Looper.loopOnce(Looper.java:205)
I/MonoDroid:  at android.os.Looper.loop(Looper.java:294)
I/MonoDroid:  at android.app.ActivityThread.main(ActivityThread.java:8177)
I/MonoDroid:  at java.lang.reflect.Method.invoke(Native Method)
I/MonoDroid:  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
I/MonoDroid:  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
I/MonoDroid:

maonaoda avatar Aug 01 '24 05:08 maonaoda

Sorry After careful investigation, I found that although the code is the same as Xamarin, the results are different . I should change my code to match the changes of Maui on Android.

So please ignore the above question.

maonaoda avatar Aug 01 '24 07:08 maonaoda

New problem

There seems to be a problem here https://android.googlesource.com/platform/frameworks/support/+/refs/heads/androidx-master-dev/viewpager2/viewpager2/src/main/java/androidx/viewpager2/adapter/FragmentStateAdapter.java#447

Thanks for feedback. Please open issue in AndroidX repo.

moljac avatar Aug 01 '24 12:08 moljac

Sorry After careful investigation, I found that although the code is the same as Xamarin, the results are different . I should change my code to match the changes of Maui on Android.

MAUI is evolution of Xamarin.Forms and .NET for Android is evolution od Xamarin.Android, but under the hood evolution has changed a lot, but the principles are the same.

Results might be different, because Maven artifacts do change.

So please ignore the above question.

moljac avatar Aug 01 '24 12:08 moljac