I have a problem when I use GoogleMap API, I think my app don't find my api_key (see the log) whereas I write it in code. MapView is opened during few second and crash. In Google API site, I enable Geocoding api, google place for android, google maps for android.
My Manifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="fr.mapeche.testnav1" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<!-- The ACCESS_COARSE/FINE_LOCATION permissions are not required to use Google Maps Android API v2, but are recommended.-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_prises"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".view.MainActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/app_name"
android:uiOptions="splitActionBarWhenNarrow" >
<!-- configChanges Permet de ne pas perdre les données lors de la rotation d'écran -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MapsActivity"
android:label="@string/title_activity_maps" >
</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="@string/google_maps_key" />//The wright API_KEY
</application>
A part of log :
06-16 15:30:00.944 10741-10852/? E/MDM﹕ [24597] b.run: Couldn't connect to Google API client: ConnectionResult{statusCode=API_UNAVAILABLE, resolution=null}
06-16 15:30:00.986 10741-10855/? E/MDM﹕ [24598] b.run: Couldn't connect to Google API client: ConnectionResult{statusCode=API_UNAVAILABLE, resolution=null}
06-16 15:30:01.077 736-840/? E/WifiStateMachine﹕ WifiStateMachine CMD_START_SCAN source 10007 txSuccessRate=0,00 rxSuccessRate=0,00 targetRoamBSSID=00:23:69:93:39:66 RSSI=-69
06-16 15:30:01.105 736-840/? E/WifiStateMachine﹕ WifiStateMachine CMD_START_SCAN source 10007 txSuccessRate=0,00 rxSuccessRate=0,00 targetRoamBSSID=00:23:69:93:39:66 RSSI=-69
06-16 15:30:02.405 9811-9811/fr.mapeche.testnav1 E/DatabaseHelper﹕ SELECT * FROM fishing ORDER BY fishing_date DESC
06-16 15:30:07.538 11045-11154/? E/SQLiteLog﹕ (283) recovered 12 frames from WAL file /data/data/com.google.android.gms/databases/playlog.db-wal
06-16 15:30:09.162 11212-11212/? E/GmsWearableLS﹕ GoogleApiClient connection failed: ConnectionResult{statusCode=API_UNAVAILABLE, resolution=null}
06-16 15:30:09.177 11212-11296/? E/MDM﹕ [24645] b.run: Couldn't connect to Google API client: ConnectionResult{statusCode=API_UNAVAILABLE, resolution=null}
06-16 15:30:09.268 11212-11308/? E/MDM﹕ [24649] b.run: Couldn't connect to Google API client: ConnectionResult{statusCode=API_UNAVAILABLE, resolution=null}
I had this problem and I found the connection was the problem. You have to create two credentials(one for debug and another one for release versions) and put them to the suitable google maps api xml files then the API wouldn't be your problem. You have to check the connection or other things.