Do you have MainLauncher=true on an activity class?
Have you cleaned and rebuilt? Or deleted bin/obj and built again?
Did you "Migrate to AndroidX"?
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I had to set the target framework to Android 10 and Visual Studio made me install the Xamarin.AndroidX.AppCompat.AppCompatResources package.
Now the application does not start anymore and I am given this error directly from Visual Studio.
I am using XF version 4.8.0.1560 and cannot update it at the moment.
Prior to add this package all works fine.
How do I fix this?
Thanks.
EDIT:
Here the full Android app.
Do you have MainLauncher=true on an activity class?
Have you cleaned and rebuilt? Or deleted bin/obj and built again?
Did you "Migrate to AndroidX"?
Hello,
Welcome to our Microsoft Q&A platform!
You can recheck if you have set the MainLauncher property for your activity ( MainLauncher=true), for example:
[Activity (Label="Awesome Demo App", MainLauncher=true)]
public class MainActivity : Activity
{
}
I had to set the target framework to Android 10 and Visual Studio made me install the Xamarin.AndroidX.AppCompat.AppCompatResources package.
Android projects built with Xamarin.Forms 5.0 require that you've installed the AndroidX (Android 10.0) platform to your development environment.
This can be accomplished with the Android SDK manager. For more information about AndroidX, see AndroidX migration in Xamarin.Forms.
Android projects will then require several updates to build correctly.
1.Minimum TargetFrameworkVersion
Xamarin.Forms 5.0 requires a minimum target framework version of 10.0 (AndroidX) for Android projects. The target framework version can be set in Visual Studio, or in the Android .csproj file:
<TargetFrameworkVersion>v10.0</TargetFrameworkVersion>
2.Minimum TargetSDKVersion
AndroidX requires that your Android manifest sets the targetSdkVersion to 29+:
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="29" />
For more details, you can check: https://learn.microsoft.com/en-us/xamarin/xamarin-forms/troubleshooting/questions/forms5-migration
You can use the Migration Tooling to achieve this.
You can enable the AndroidX Migrator via Tools > Options > Xamarin > Android Settings inside Visual Studio 2019 (you can skip this step on Visual Studio for Mac).

Right-click your project and Migrate to AndroidX.

For more details, please check: https://learn.microsoft.com/en-us/xamarin/android/platform/androidx#migration-tooling
Update:
I have redone the entire procedure and this new error is appeared.
For the new problem, you can try the following steps:
1.update packages to latest with legacy Android.Support (28.0.0.3) + build
2.add Xamarin.AndroidX.Migration + rebuild
You can refer to this issue: https://github.com/xamarin/AndroidX/issues/4
Best Regards,
Jessie Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.