I am trying to do a MapActivity using Android Studio. It has to show the user’s location.
Well, I know I need a key in order to use the API, and believe me, I changed that key at least four times… I also have the permissions in the AndroidManifest.xml.
The thing is I can show the map without the user’s location, but if I try to show his/her location, then the app compiles well BUT when I try to execute it, it stops and I obtain this error:
11-12 09:13:28.416 21576-21653/raquel.mapapplication W/DynamiteModule: Local module descriptor class for com.google.android.gms.googlecertificates not found.
11-12 09:13:28.424 21576-21653/raquel.mapapplication I/DynamiteModule: Considering local module com.google.android.gms.googlecertificates:0 and remote module com.google.android.gms.googlecertificates:2
11-12 09:13:28.424 21576-21653/raquel.mapapplication I/DynamiteModule: Selected remote version of com.google.android.gms.googlecertificates, version >= 2
11-12 09:13:28.432 21576-21653/raquel.mapapplication W/System: ClassLoader referenced unknown path: /data/user/0/com.google.android.gms/app_chimera/m/0000000b/n/armeabi
11-12 09:13:28.436 21576-21653/raquel.mapapplication D/GoogleCertificates: com.google.android.gms.googlecertificates module is loaded
11-12 09:13:28.504 21576-21653/raquel.mapapplication D/GoogleCertificatesImpl: Fetched 190 Google release certificates
11-12 09:13:28.505 21576-21653/raquel.mapapplication D/GoogleCertificatesImpl: Fetched 363 Google certificates
11-12 09:13:31.235 21576-21576/raquel.mapapplication I/Process: Sending signal. PID: 21576 SIG: 9
It mentions something about Google Certificates, and that is why I thought maybe it has something to do with the key… But I am not sure and I do not have idea what I am doing wrong.
Thank you for your help.
////////
Ok, I will try to post some code... I have been changing the code all the time, but this is the last I tried (I also tried setMyLocationEnable(true), because getMyLocation() is deprecated, but I obtain the same error):
public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {
private GoogleMap mMap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
Location location=mMap.getMyLocation();
double lat=location.getLatitude();
double lon=location.getLongitude();
// Add a marker in Sydney and move the camera
LatLng sydney = new LatLng(lat, lon);
mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
}
}
Thanks the person who answered me and the person who edited my comment... I still do not well how to format text...
Open the sdk manager
, download/update google play services
.
And create a new emulator.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With