I have a PCL-based Xamarin Forms solution using Xamarin.Forms version 2.3.4.270.
When building the Xamarin android project in Visual Studio 2017, in the autogenerated "...\obj\Debug\android\AndroidManifest.xml" file of the android project there is a mysterious activity added that causes two app icons to be deployed when running the app on a phone:
<activity android:name="md54d0b3c92dfecf2a187a4c8b660786aba.MainActivityForCodeAnalysisBugWorkaroundPleaseIgnore">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I made sure that none of the projects in the whole solution is marked with "Enable Code Analysis on Build" and I have only one main activity with "MainLauncher = true"...
When starting the first app icon, only a blank empty view is shown. When starting the second app icon, the real app is started.
How can I get rid of the aditional app icon on android?
EDIT: This is the MainActivity:
[Activity(Label = "@string/app_name", Theme = "@style/MyTheme", ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
And this is the SplashScreen-Activity with MainLauncher=true:
[Activity(Theme = "@style/MyTheme.Splash", MainLauncher = true, NoHistory = true)]
public class SplashActivity : AppCompatActivity
I have used this approach in various other xamarin.forms applications with no issues yet.
Here is the Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="@string/package_name" android:versionCode="1" android:versionName="1.0" android:installLocation="auto">
<uses-sdk android:minSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:label="@string/app_name" android:icon="@drawable/icon"></application>
</manifest>
Mainactivitycode where yourMainLauncher = trueis and also yourAndroidManifest.xmlcode. - Eren Shen