NyAja Powell
NyAja Powell

Reputation: 31

Android Studio saying places api not enabled

I'm trying to use the Places API in my app. My Logcat keeps giving me these two errors even though the Api is enabled:

03-17 05:31:34.777 2759-3241/com.google.android.gms.persistent E/Volley: 
[158] BasicNetwork.performRequest: Unexpected response code 403 for 
https://www.googleapis.com/placesandroid/v1/getAutocompletePredictions? 
key=<api key>

03-17 05:31:34.782 2759-7906/com.google.android.gms.persistent E/Places: 
Places API for Android does not seem to be enabled for your app. See 
https://developers.google.com/places/android/signup for more details.

I've tried adding

implementation 'com.google.android.libraries.places:places-compat:1.0.0'

and

implementation 'com.google.android.libraries.places:places:1.0.0'

but neither seems to have helped. I'm able to search for a location, but as I type in the search bar, I get a "Places_Api_Access_Not_Configured" error. My Api dashboard shows that there is activity, so I'm not sure what the problem is.

This is what my dependencies currently look like

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.android.gms:play-services-maps:16.0.0'

    implementation 'com.google.android.gms:play-services-location:16.0.0'
    //implementation 'com.google.android.gms:play-services-places:16.0.0'
    implementation 'com.google.android.libraries.places:places-compat:1.0.0'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.google.firebase:firebase-core:16.0.6'

    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'org.webjars.npm:debug:4.1.0'
    //implementation 'com.google.firebase:firebase-admin:6.7.0'
    //implementation 'com.firebase:geofire-android:2.1.1'
    implementation 'com.google.gms:google-services:3.1.1'

}
apply plugin: 'com.google.gms.google-services'

Upvotes: 2

Views: 1040

Answers (2)

O-BL
O-BL

Reputation: 325

If you are using Place Picker or Place Autocomplete you should avoid them, because they are deprecated since January 29, 2019 as indicated here.

An alternative for Place Picker is to implement it yourself, please see this thread.
And if you want to use Place Autocomplete I suggest you give Pelias a go.

Upvotes: 2

Joseph
Joseph

Reputation: 6031

Sometimes they are caching issues. Try delete the API key and re-create it again. Make sure you are not restricting the API key.

Only apply the restrictions after the key is working properly. Note, you might need to wait 5 minutes before using the new key.

When using the Google Places API for Web, you will also need to enable the Google Maps JavaScript API.

Upvotes: 0

Related Questions