1
I’m adding a feature in an app of mine that will show specific locations near the user.
( Follow the example that struck me )
Follow screen print on Activity:
EDIT:
E/Google Maps Android API(21658): Authorization failure. Please see the Google Console for how to correctly set up the map.
E/Google Maps Android API(21658): In the Google Developer Console
E/Google Maps Android API(21658): Ensure that the "Google Maps Android API v2" is enabled.
E/Google Maps Android API(21658): Ensure that the following Android Key exists:
E/Google Maps Android API(21658): API Key: AIzaSyA********************************
E/Google Maps Android API(21658): Android Application (<cert_fingerprint>;<package_name>): 42:89:CD:56:4E:08:9A:67:**:**:**:**:**:**:**:**:**:**:**:**;"NOME DO MEU PACOTE"
The key is created, but the above error occurs
Also occurs a Nullpointer:
java.lang.NullPointerException: Attempt to invoke virtual method 'double android.location.Location.getLatitude()' on a null object reference
I didn’t even change anything in class.
Follow the section where the error occurs:
Line 72:
StringBuilder sbValue = new StringBuilder(sbMethod());
Line 144:
public StringBuilder sbMethod() throws SecurityException {
LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
Criteria criteria = new Criteria();
String provider = locationManager.getBestProvider(criteria, true);
Location myLocation = locationManager.getLastKnownLocation(provider);
mLatitude = myLocation.getLatitude();
mLongitude = myLocation.getLongitude();
Detail more your problem, put parts of your code.
– Taisbevalle
You generated the API key?
– Thiago Luiz Domacoski
Gerei, @Thiagoluizdomacoski
– Rodrigo
Displays an error in the Console?
– Thiago Luiz Domacoski
I added console errors here, @Thiagoluizdomacoski
– Rodrigo
Put it on, @Taisbevalle
– Rodrigo
debug or release mode?
– viana
has a part that says "Ensure that the "Google Maps Android API v2" is enabled.". Vc saw if in the google dashboard vc enabled the maps?
– André Vicente
@Andrévicente there on the console only found Google Maps Android API, not found Google Maps V2.
– Rodrigo
I decided! I changed the tag android:name="com.google.android.maps.V2.API_KEY" by android:name="com.google.android.geo.API_KEY".
– Rodrigo