I just switched to Android Studio from Eclipse. For the first two week, the Map Fragment was working for my two devices, one with Android version 4.1.2 and the other 5.0.
This past Friday, something strange happened:
For my device w/ 4.1.2 Android, I got this error:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mycompany.myproject/com.mycompany.myproject.MainActivity}: android.view.InflateException: Binary XML file line #9: Error inflating class fragment
It works perfectly fine on my device with 5.0.2.
Any idea?
A snippet of the layout file...
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/MainActivityContainer"
tools:context=".MainActivity" >
<fragment
android:name="com.google.android.gms.maps.MapFragment"
android:id="@+id/map_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
EDIT:
Apparently, there's nothing wrong w/ the code and XML, because I create a brand new project and copy-and-paste the code and XML that project and everything work as it is supposed to. Does anyone know if there's a configuration on an Android Studio project that could limit the use of map fragment?