Xamarin Forms Android project causes two app icons - xamarin

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>

This issue was due to a pcl dependency that wanted to fix a code analysis issue by adding a new activity with MainLauncher = true.
See https://bugzilla.xamarin.com/show_bug.cgi?id=43553.
The Android implementation of the pcl library added an additional activity.
In the main xamarin android project, Visual Studio included this activity in the manifest file.
So all in all the solution for the code analysis issue for android pcl libraries as described in the link, causes two app icons.
To remove the second app icon, just set the "MainLauncher" of the pseudo activity property to false. This will still let you run the code analysis but will not add a second app icon.

Related

React Native Image not working Android both in emulator and in device

<Image /> is shown in iOS simulator but not shown in Android emulator and device.
It's only not working when I use it as custom marker for google maps
<MapView.Marker
coordinate={this.state.spot}
>
<View style={styles.customMarker}>
<Image style={styles.marker}
source={images.customMarker}
resizeMode='stretch'
/>
</View>
</MapView.Marker>
it could be the problem with simulator as well as it happens with weak network
try completely resetting it. (as if it were a new iPhone). "Reset content and settings"
Keep an eye on your image url as well.
Rebuild your project and run . It works for me.

Why are my Xamarin UWP Images not showing up on device?

I am developing a Xamarin UWP app using ffimageloading. The images show up just fine on the Windows Phone emulator that I am running through Visual Studio, but when I deploy it to a device through the device portal all of the images are missing.
<ffimageloading:CachedImage Grid.Column="0" Grid.Row="1"
Source="{helpers:ImageResource MyProject.Assets.Images.music-doublenote.png}" />
The issue was the build configuration. By turning off "Compile with .NET Native tool chain" on the Build tab of Properties for the Release configuration of the main UWP app and deploying the app with WinAppDeployCmd.exe
I had the same problem whenever I kept the image file inside any folder (for. eg assests). But later i started keeping the images file in the main project folder; I didn't keep them inside any folders and they started to show up in the application.
To get "Compile with .NET Native tool chain" working you have to use UWP-specific overload of the Forms.Init call which allows to correctly include FFImageLoading assemblies for Xamarin.Forms usage:
// you'll need to add `using System.Reflection;`
List<Assembly> assembliesToInclude = new List<Assembly>();
//Now, add in all the assemblies your app uses
assembliesToInclude.Add(typeof (FFImageLoadingAssembliesHere).GetTypeInfo().Assembly);
//Also do this for all your other 3rd party libraries
Xamarin.Forms.Forms.Init(e, assembliesToInclude);
// replaces Xamarin.Forms.Forms.Init(e);
I also had the issue with images not showing up on my UWP app. The images were showing up on my Android project but not UWP. For me the solution was to add the file extension. For some reason "myimage" works on Android but not on UWP, has to include the file extension like "myimage.png". Just wanna leave this here for anyone else potentially experiencing the same issue.

Application not found on Android TV

I have an app created for Android TV but I cannot discover it on Nexus Player when I try to search for it in Google Play Store. The application has been approved for distribution on Android TV but still not discoverable.
Any ideas what could be wrong with manifest/distribution options that causes the app to be filtered out on Nexus Player devices?
Make sure you mention that the TV supports LEANBACK:
<uses-feature
android:name="android.software.LEANBACK"
android:required="true" />
And that the app does not require a touchscreen:
<uses-feature
android:name="android.hardware.TOUCHSCREEN"
android:required="false" />
Without those manifest tags the Play Store may not show your app

how to run an android wear app in virtual devices?

how to run an android wear app in virtual devices? i want to learn android wear develop, but i do not have a watch, so i want to use a virtual devices.
i set up a virtual devices in eclipse, 4.4.2W, when i run the app, the virtual device do not occur in the select devices list
<uses-feature android:name="android.hardware.type.watch" />
<uses-sdk
android:minSdkVersion="20"
android:targetSdkVersion="20" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity android:name="com.example.helloword.MyActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
From the Android-SDK get the complete set of things installed for 4.4.2W, and launch an AVD with Android Wear Round...you will be good to go :)

Android Market statistics show zero Honeycomb devices: should I worry?

My app is supposed to support tablets, I don't have any Honeycomb device at hand but I guess it should work there too.
PROBLEM: in the Android Market, I can see:
Android 2.2: 58.1% (14,994)
Android 2.1: 17.6% (4,533)
Android 2.3.3: 11.6% (3,003)
Android 1.6: 3.6% (922)
Android 1.5: 2.8% (721)
Android 2.3: 1.4% (362)
Android 2.0.1: 0.0% (10)
Android 1.0: 0.0% (9)
Android 2.0: 0.0% (5)
Android 1.1: 0.0% (2)
No Android 3.x anywhere to be seen. Does it mean my app is not visible on the Android Market for 3.x users?
In case it matters, I did declare support for large screens:
<uses-sdk android:minSdkVersion="3"
android:targetSdkVersion="11"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<supports-screens
android:resizeable="true"
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>
EDIT: I just noticed that "All apps in my category" also does not list Honeycomb. I can't believe there are more Android 1.0 installs than Android 3.x installs for all apps in my category. Is it a problem with Market statistics?
Assuming that you're referring to Ankidroid, it does show up on the Xoom and installs just fine. Once your stats are updated, you should see at least one 3.1 download.
And yes, it seems like a great app! :-)
I think it's an issue with the statistics window..
My widget is mostly of interest for the Asus Transformer users (initial release with 3.0, upgraded globally to 3.1 most everywhere).. If i look at statistics (mine and the "in my category" ones), anything above SDK 10 is missing (so no Android 3.* devices)..
Funnily enough, the top entry there is Android 2.2 12.6% (187)
In the next graph, is a per-device statistics... first item? EeePad 76.2% (1,127)
If you look at the first pie chart, about 80% of the devices are in the "Other" category.. I think (read: hope) it's just the statistics interface that's not showing the data properly, but the data is logged correctly.. I hope so anyway
SOLVED: 3.x was still not visible yesterday, but starting from today (2011 Jul 12) it is visible!
They also performed some UI changes. The Honeycomb bug fix was probably part of the whole overhaul.
At first sight I would say they did log the correct data all along but just did not display correctly (until today).

Resources