I created my google-api-key for google maps v2 for Android, everything is configured in eclipse for google maps (using google + api build, google play services links, sorting api key, etc.), I can view the map the application works fine on my phone, but when I look at the same application on AVD, it goes to the right place, and I can see all the overlays of the Google map (for example, the zoom button), but there is no map, this is just a gray square. The network is also beautiful.
I use the latest build 4.3 of API 18 and my AVD is the default Nexus One. Prior to that, I received a terrible update message google play services, which I found due to the fact that the cards v2 just did not work on 4.2, so I updated the reading so that the cards worked fine with SDK 18 on AVD.
Any idea why it is not showing? I noticed that when I start AVD, it says using opengl software, but I would think that everything is fine.
I read several stackoverflow articles, but they all point to the wrong configuration, and everything is fine with me, and I work just like a dandy when I send it to my phone and do not give any errors.
If any help here contains some snippets of code that I use.
manifest:
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-library android:name="com.google.android.maps" />
<meta-data android:name="com.google.android.maps.v2.API_KEY"
android:value="XXXXXXXXXXXXXXXXXXXX"/>
fragment layout:
<fragment
android:id="@+id/worldmap"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
to initialize the card:
private void initialiseMap() {
if (googleMap == null) {
googleMap = ((SupportMapFragment) getFragmentManager().findFragmentById(
R.id.worldmap)).getMap();
// check if map is created successfully or not
if (googleMap == null) {
Toast.makeText(activity.getApplicationContext(),
"Unable to create maps", Toast.LENGTH_SHORT)
.show();
}
}
}
to display the map:
private void displayLocation(Location l, String text) {
if(googleMap!=null) {
googleMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
LatLng ll=new LatLng(l.getLatitude(), l.getLongitude());
CameraPosition cp=new CameraPosition.Builder()
.target(ll)
.zoom(18)
.build();
googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cp));
Toast.makeText(activity, l.getLatitude()+":"+l.getLongitude(), Toast.LENGTH_LONG).show();
}
}