I tried to make a sample project using Google Map, but I couldn\'t. Help me please!
Test Device : Android 4.0.4
Error Message :
12-2
This defect has been resolved in play services library v9.0.0. https://code.google.com/p/gmaps-api-issues/issues/detail?id=9021#makechanges
In my case, I had to do two corrections to make this exception go away.
Some times you are using both -
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="<YOUR VALUE>"
/>
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="<YOUR VALUE>"
/>
Make sure , Don't use both ... if you need Location , Places and maps then use geo.API_KEY and if you need places and maps then use maps.v2.API_KEY
Even if it's an already answered question this error can also appear if you call the super.onCreateView
in your fragment. It will crash at run time.
Be sure you overridden the onCreateView
method and inflated your layout:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.my_fragment, container, false);
return view;
}
You are extending FragmentActivity
, indicating that you are trying to use the Android Support package backport of fragments. However, your <fragment>
element refers to MapFragment
, which is for the native API Level 11 edition of fragments.
Replace MapFragment
with SupportMapFragment
, and that should clear up this specific crash.
Use the internet permission to be direct child of manifest file.. Like below and try..
Also You should have the following for using map:
1.Should extend Map activity
in your activity file
2.Should have API key i didn't see any key in your code.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.test_googlemap"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET"/>
<uses-sdk
android:minSdkVersion="3"
android:targetSdkVersion="15" />