Android Google Maps V2 Stopping
I am new to Android and Google Maps v2 API. I tried to integrate the API in my app but I am getting: Unfortunately, Map Example has stopped. Can anyone help me finding the mistak
Solution 1:
ClassNotFoundException, so mostly you have missed adding the library dependency. The Google Play Services need to be setup before using them into your project. Find details in the following link:
https://developers.google.com/android/guides/setup
As per official documentation here https://developers.google.com/maps/documentation/android/start, the minimum required sdk version is 12. Please try increasing your minSdkVersion value to 12.
Solution 2:
Your code seems fine. You may try this way, This is mentioned in the official docs,
@OverrideprotectedvoidonCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setUpMapIfNeeded()
}
privatevoidsetUpMapIfNeeded() {
MapFragmentmapFragment= (MapFragment) getFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(MainActivity.this);
}
@OverridepublicvoidonMapReady(final GoogleMap googleMap) {
// map has been loaded
}
Make sure your class implements OnMapReadyCallback
Post a Comment for "Android Google Maps V2 Stopping"