I realize that similar questions have been asked multiple times here, but with everything I found on stackoverflow, I can't get Google maps v2 to work on Android using Eclipse.
This is in my manifest file:
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="21" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name="com.my.app.activity.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="....." />
</application>
This is in my main activity:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
.getMap(); }
This is the layout file:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
I added the google-play-services_lib to the project via project/properties/android/Library.
What I get is Eclipse showing a heap overflow. My eclipse.ini has
-XX:MaxPermSize=2048m
-Xms512m
-Xmx2048m
What happens is my Eclipse screen goes dark, Eclipse doesn't respond, and finally reports "GC overhead limit exceeded" and "Unhandled event loop exception". It never actually starts the app. This happened both on Eclipse Kepler and Eclipse Luna. I'm at a loss :-)
edit: I created a new empty android project, I followed the steps in https://developers.google.com/maps/documentation/android/start and I get the same error.
Unable to execute dex: GC overhead limit exceeded
GC overhead limit exceeded
and
conversion to Dalvik failed