Error Inflating Class Fragment Google Maps V2
I've spent 24 hours trying to deploy a simple google maps v2 android apps. I've searched in a lot of forums (included stackoverflow)... but I'm desperated. The error is: android.vi
Solution 1:
Assuming you have got the correct jars..etc. Your xml seems fine. here is what you can try doing.
publicclassMainActivityextendsandroid.support.v4.app.FragmentActivity {
private GoogleMap mMap;
@OverrideprotectedvoidonCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Try to obtain the map from the SupportMapFragment.
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
.getMap();
if (mMap== null)
{
Toast.makeText(this,"Google Maps not Available",
Toast.LENGTH_LONG).show();
}
}
Now, why this.. You have chosen min sdk as 8. FragmentActivity works only for API 11+, to make it compatible for below versions also, you need to extend it the way I have done.
Also, in your OnCreate I see absolutely nothing, there is no map instance created by you. What are you expecting to show on the screen?
Solution 2:
try to add
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
into AndroidManifest.xml
It works for me!
Post a Comment for "Error Inflating Class Fragment Google Maps V2"