Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I have a working GoogleMaps v2 application and initially I had the same issues that you describe. The problem in my case was that the API key I used was not matching the certificate I used to sign the application (debug/dev for the development phase and release for the Play released app). The application is working on all Android versions from 10 and on (so it works on 2.3.3). From the log error it sssems you may be having a connectivity issue. Did you declare the appropriate uses permissions? It should be:</p> <pre><code>&lt;uses-permission android:name="android.permission.INTERNET"/&gt; &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/&gt; </code></pre> <p>Here is a short snippet of the main map code:</p> <pre><code>public class LocationActivity extends MapActivity { private MapController mapController; private MapView mapView; private LocationManager locationManager; private MyLocationOverlay myLocationOverlay; public void onCreate(Bundle bundle) { super.onCreate(bundle); if(Utils.isRelease(getApplicationContext())) { setContentView(R.layout.location_activity_release); // bind the layout to the activity } else { setContentView(R.layout.location_activity); // bind the layout to the activity } // Configure the Map mapView = (MapView) findViewById(R.id.mapview); mapView.setBuiltInZoomControls(true); mapView.setSatellite(false); mapController = mapView.getController(); mapController.setZoom(15); // Zoon 1 is world view myLocationOverlay = new MyLocationOverlay(this, mapView); mapView.getOverlays().add(myLocationOverlay); // More map configurations follow... </code></pre> <p>And the layouts (notice the difference in the maps API key): location_activity.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;com.google.android.maps.MapView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mapview" android:layout_width="match_parent" android:layout_height="match_parent" android:apiKey="@string/google_maps_v1_api_key" android:clickable="true" /&gt; </code></pre> <p>And (location_activity_release.xml):</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;com.google.android.maps.MapView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mapview" android:layout_width="match_parent" android:layout_height="match_parent" android:apiKey="@string/google_maps_v1_api_key_release" android:clickable="true" /&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload