I'm currently developing an application that integrate with google map. However it didn't run as I expect to be. It shows nothing, just a blank gray screen.
I've checked my adb and grep Auth
there doesn't seems any mistake in authorization. Which means it's eliminate the possibility of mistake API_KEY.
I wonder what's the possibilities that I didn't see. I hope to find some insights here..
My Manifest
<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"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="[Removed]"/>
My Gradle
compile 'com.google.android.gms:play-services:7.8.0'
My fragment XML
<com.google.android.gms.maps.MapView
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
My Fragment
public class CurrentLocationFragment extends Fragment implements OnMapReadyCallback {
private MapView mapView;
private GoogleMap map;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_current_location, null);
FragmentManager fm = getChildFragmentManager();
mapView = (MapView) view.findViewById(R.id.map);
mapView.onCreate(savedInstanceState);
map = mapView.getMap();
map.getUiSettings().setMyLocationButtonEnabled(false);
map.setMyLocationEnabled(true);
//initialize the map
try {
MapsInitializer.initialize(this.getActivity());
} catch (Throwable e) {
e.printStackTrace();
}
//animate the camera
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(new LatLng(43.1, -87.9), 10);
map.animateCamera(cameraUpdate);
return view;
}
Any Insights will be much appriciated! Thanks..