Xamarin.Forms Android No launchable activity found

Matteo Pozzato 116 Reputation points
2021-03-31T14:01:43.13+00:00

I had to set the target framework to Android 10 and Visual Studio made me install the Xamarin.AndroidX.AppCompat.AppCompatResources package.

83209-screenshot-2021-03-31-at-155137.png

Now the application does not start anymore and I am given this error directly from Visual Studio.

83326-image.png

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.

Developer technologies | .NET | Xamarin
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. martinwhitman1 326 Reputation points
    2021-03-31T15:46:55.3+00:00

    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"?

    0 comments No comments

  2. JessieZhang-MSFT 7,721 Reputation points Microsoft External Staff
    2021-04-01T02:22:19.027+00:00

    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).

    83388-image.png

    Right-click your project and Migrate to AndroidX.

    83474-image.png

    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.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.