Cannot Resolve Symbol Google API Client in Android Studio
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;
For the benefit of searchers:
If you are following the android tutorial that relates to this, you can add the dependency via the UI.
- In Android Studio, go to File > Project Structure.
- Go to the dependencies tab.
- On the right hand side add a 'Library Dependency'.
- Type "com.google.android.gms:play-services" into the searchbox and pick the appropriate dependency.
- Then follow @Dmac's answer
I had to do the following to get my app to compile successfully:
- Update my build.grade with
'com.google.android.gms:play-services:<version>'
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;
In Android Studio: File --> Invalidate/Restart...
Clean build