I have encountered couple of issue while trying to run xamarin forms app in android emulator.
1> Got this error message randomly while trying to run simple xamarin forms PCL app on android emulator:
Failure [INSTALL_FAILED_INVALID_APK: Package couldn't be installed in /data/app/App2.Android-1: Package /data/app/App2.Android-1/base.apk code is missing]
2> Also got this error frequently : The "LinkAssemblies" task failed unexpectedly.. I already tried by increasing Java max Heap Size to 1024 but it did not work.
Error details:
The "LinkAssemblies" task failed unexpectedly.
1>System.IO.IOException: The process cannot access the file 'obj\Debug\android\assets\App2.Android.dll' because it is being used by another process.
1> at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
1> at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
1> at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
1> at Xamarin.Android.Tools.Files.CopyIfChanged(String source, String destination)
1> at Xamarin.Android.Tasks.MonoAndroidHelper.CopyIfChanged(String source, String destination)
1> at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
1> at Xamarin.Android.Tasks.LinkAssemblies.Execute()
1> at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
1> at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()
1>Done building project "App2.Android.csproj" -- FAILED.
Sometime I was able to run my app though by cleaning solution, delete dlls from bin folder but it's really painful.
Also data is not showing in listview. I am not sure what I am missing. Here is my code:
MainPage.xaml:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage.Content>
<Grid.RowDefinitions>
</Grid.RowDefinitions>
MainPage.xaml.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace App2
{
public partial class MainPage : ContentPage
{
public List NameList { get; set; }
public MainPage()
{
NameList = new List();
NameList.Add(new Name { FirstName = "aaaa" });
NameList.Add(new Name { FirstName = "bbbb" });
NameList.Add(new Name { FirstName = "ccccc" });
InitializeComponent();
}
protected override void OnAppearing()
{
BindingContext = NameList;
base.OnAppearing();
}
}
public class Name
{
public string FirstName { get; set; }
}
}
I am using Latest Xamarin version, jdk 1.8, Android 7.1 platform.
It's really painful to use Xamarin and very time killer. Please help