Cannot Resolve Symbol Google API Client In Android Studio


Answer :

For the benefit of searchers:

If you are following the android tutorial that relates to this, you can add the dependency via the UI.

  1. In Android Studio, go to File > Project Structure.
  2. Go to the dependencies tab.
  3. On the right hand side add a 'Library Dependency'.
  4. Type "com.google.android.gms:play-services" into the searchbox and pick the appropriate dependency.
  5. Then follow @Dmac's answer

Even though not officially listed in the tutorial, you must use the following imports:

import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks; import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener; import com.google.android.gms.location.LocationListener; import com.google.android.gms.location.LocationRequest; import com.google.android.gms.location.LocationServices; 

I had to do the following to get my app to compile successfully:

  1. Update my build.grade with 'com.google.android.gms:play-services:<version>'
  2. Add imports as needed:

    import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.api.ResultCallback; import com.google.android.gms.common.api.Status; 
  3. In Android Studio: File --> Invalidate/Restart...

  4. Clean build


Comments

Popular posts from this blog

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Can Feynman Diagrams Be Used To Represent Any Perturbation Theory?