I am getting couple of errors while trying to run xamarin forms app on android emulator:
A> Got this error randomly:
**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] **
B>**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.
A have already tried by increase Java Max heap size to 1048 but still getting this error frequently.
Sometimes I am able to run xamarin forms app by cleaning and closing the solution and rebuild it.
Also I am not able to show data inside ListView. Here is my sample code:
MainPage.Xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage.Content>
<Grid.RowDefinitions>
</Grid.RowDefinitions>
<ListView.ItemTemplate>
<ViewCell.View>
</ViewCell.View>
</ListView.ItemTemplate>
</ContentPage.Content>
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; }
}
}
It is a PCL project.
I am using latest xamarin version, jdk 1.8, Android 7.1 platform.
Android emulator running on API level 25, using host GPU and 2048 RAM.
**
** Please help**