Santhosh

Santhosh

  • NA
  • 300
  • 136.5k

Android.Views.InflateException: Binary XML file line #1

Dec 5 2016 8:07 AM

Hi,

I am developing sample Google map application in Xamarin Andriod.
when I run this application it display this error.

"Android.Views.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class fragment"

main.axml:

 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:orientation="vertical" 
android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 android:paddingTop="20dp"
 android:paddingLeft="8dp"
 android:paddingRight="8dp"> 
<fragment android:id="@+id/map"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 class="com.google.andriod.gms.maps.MapFragment" />

mainActivity.cs::

namespace GMap
{
[Activity(Label = "GMap", MainLauncher = true, Icon = "@drawable/icon")]
public class MainActivity : Activity, IOnMapReadyCallback
{
// private GoogleMap mMap;

 protected override void OnCreate(Bundle bundle)
 {
 base.OnCreate(bundle); 
// Set our view from the "main" layout resource 
SetContentView(Resource.Layout.Main); //ERROR DISPLAY IN THIS LINE 
MapFragment mapfragment = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map); 
 mapfragment.GetMapAsync(this);
 } 
public void OnMapReady(GoogleMap googleMap) 
{
 MarkerOptions markerOption = new MarkerOptions();
 markerOption.SetPosition(new LatLng(16.03, 108)); 
 markerOption.SetTitle("My Position");       
googleMap.AddMarker(markerOption); 
} 
}

how solve this error..???