react-native-google-places icon indicating copy to clipboard operation
react-native-google-places copied to clipboard

[Workaround found] Android > The provided API key is invalid.

Open ispiropoulos opened this issue 5 years ago • 3 comments

I have an unrestricted key that works well on iOS but on Android it returns "The provided API key is invalid."

Latest react-native-google-places

I am using React Native Config library and have set the gradle.properties file as such:

RNGP_ANDROID_API_KEY=project.env.get("GOOGLE_API_KEY")

I have also tried:

  • Using the export method but same result
  • Adding the key in the manifest file but same result
  • Restricting the key to Maps iOS, Google Places API, Google Places iOS SDK but same result

Am I missing something? Thank you in advance.

ispiropoulos avatar Dec 23 '19 13:12 ispiropoulos

So I managed to find a workaround by adding resValue "string", "places_api_key", "\"${project.env.get("GOOGLE_API_KEY")}\"" in build.gradle but I do not think this should be considered as a legit fix.

ispiropoulos avatar Dec 23 '19 14:12 ispiropoulos

This breaks appcenter properly reading build types.

webraptor avatar Feb 14 '22 11:02 webraptor

resValue "string", "places_api_key", ""${project.env.get("GOOGLE_API_KEY")}"" resValue "string", "places_api_key", project.env.get("GOOGLE_API_KEY") is compatible with appcenter.

PS: they don't support optional chaining (?) either

webraptor avatar Feb 14 '22 15:02 webraptor