How customize theme in .NET9 Android Application project? #31002
Replies: 4 comments 9 replies
-
In your project file, you have to define specific version of "Xamarin.AndroidX.Lifecycle.Runtime". At least, this was something I had to do, for similar error on a different reference library. Check the first point in CoPilot AI answer. |
Beta Was this translation helpful? Give feedback.
-
What is the "Android Application" project type purpose? Why MainActivity is not AppCompatActivity by default like in MAUI or in Xamarin Native? May be it it a bug? |
Beta Was this translation helpful? Give feedback.
-
The problem is in "Xamarin.AndroidX.Lifecycle.Runtime (>= 2.8.7.4 && < 2.8.8) but version Xamarin.AndroidX.Lifecycle.Runtime 2.9.1 was resolved". You have to define lower version of Xamarin.AndroidX.Lifecycle.Runtime and try again. Xamarin.AndroidX.Lifecycle.Runtime - 2.8.7
This might not be optimal, as you will have older version of Xamarin.AndroidX.Lifecycle.Runtime. It is just to get the error gone. |
Beta Was this translation helpful? Give feedback.
-
Can you please make a screenshot of what you are trying to hide (App bar (ActionBar))? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,

I have created "Android Application" project, .NET 9 (Visual Studio 2022 - see screen) which supports Android 15.
To hide App bar (ActionBar) the xml-code was added:
MainActivity.cs:
using AndroidX.AppCompat.App; ... [Activity(Label = "@string/ApplicationName", MainLauncher = true, Theme = "@style/AppTheme.NoActionBar")] public class MainActivity : AppCompatActivity {
I have installed the package xamarin.androidx.appcompat\1.7.1\ (for AndroidX.AppCompat.App using)
But I have warning:
Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.Process 2.8.7.4 requires Xamarin.AndroidX.Lifecycle.Runtime (>= 2.8.7.4 && < 2.8.8) but version Xamarin.AndroidX.Lifecycle.Runtime 2.9.1 was resolved.
When I run app I have error:
System.TypeLoadException: 'Could not resolve type with token 0100003f from typeref (expected class 'AndroidX.SavedState.ISavedStateRegistryOwner' in assembly 'Xamarin.AndroidX.SavedState, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') assembly:Xamarin.AndroidX.SavedState, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null ...
Please help - "Android Application" project type is work? Is it possible to use it for build app for Android 15?
Beta Was this translation helpful? Give feedback.
All reactions