Couldn't connect to Google API client

后端 未结 7 712
无人共我
无人共我 2020-12-11 16:59

I can\'t fetch last known location. I have enabled Geocoding API and Google Places API for Android in google console. I added api key to ma

7条回答
  •  情深已故
    2020-12-11 17:50

    My app uses Google Drive API, and I faced the same issue "Couldn't connect to Google API client: ConnectionResult{statusCode=API_UNAVAILABLE, resolution=null} on some devices. Advice to go through Start Integrating Google Sign-In into Your Android App helped but left me really confused:
    How google-services.json influences on resulting apk? Should I do the same for release certificate and so on?...
    Eventually I found what is behind the scene and another answer reveals that google-services.json is just optional.

    So these steps helped me:

    1. Open Google Developer Console and open/create a project
    2. In side menu open 'API Manager'
    3. On left column tap on 'Credentials'
    4. 'Add credentials' -> 'OAuth 2.0 client ID' -> 'Android' and fill it for each certificate that can be used for signing your app, i.e.: release certificate, Jenkins debug certificate, local debug certificate

    Also don't forget to check that corresponding API is enabled in your project (see step #1)

    During generating google-services.json via Start Integrating Google Sign-In into Your Android App the same 'OAuth 2.0 client ID' is created implicitly.

提交回复
热议问题