react-native-google-places
react-native-google-places copied to clipboard
[Workaround found] Android > The provided API key is invalid.
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.
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.
This breaks appcenter properly reading build types.
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