I'm building a group project where I need to use the Google Maps and Places APIs in an Android app. A couple other of my group members have the API working in their environment and even shared their API keys with me, but it doesn't work on my end. When I try the Autocomplete function, it displays "Can't load search results" and when I try displaying the Google Map it is simply blank. The project still runs fine and all other functionality is working so I'm assuming the only problem is with connecting to the API.
I've looked at related posts like the below: Google Maps shows blank screen Google Map API v2 Blank Screen
I've tried all of the following with no change:
- I have enabled Places API and Maps SDK for Android in Google Cloud Console
- I have added the metadata for the API key to my manifest
<meta-data android:name="com.google.android.geo.API_KEY" android:value="@string/api_key" />
I added restrictions to my API key with my project's package name and SHA-1 certificate. My teammate's API key is unrestricted and works for her, so I tried that key as well but it does not work for me.
Yes, there is a billing account associated with my Google Cloud project.
This is what my application's build.gradle looks like:
plugins {
id 'com.android.application' version '7.4.2' apply false
id 'com.android.library' version '7.4.2' apply false
id 'org.jetbrains.kotlin.android' version '1.8.0' apply false
id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin' version '2.0.1' apply false
And I have the following dependencies in my module's build.gradle:
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.navigation:navigation-fragment:2.5.3'
implementation 'androidx.navigation:navigation-ui:2.5.3'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.google.android.libraries.places:places:3.0.0'
implementation 'com.google.maps.android:android-maps-utils:2.2.0'
implementation 'com.google.android.gms:play-services-cronet:18.0.1'
}
I'm truly at a loss for why this is happening, I've scoured so many posts that seem outdated and I'm not sure where to turn next. Any help would be appreciated!