charles young
charles young

Reputation: 2289

Android Studio cannot resolve symbol common

I followed the migration guide from Eclipse to Android Studio carefully and the only error that I am getting is "cannot resolve symbol common" and is happening on these lines:

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;

Does anyone know why this would be happening?

Upvotes: 6

Views: 8029

Answers (2)

Rahul Sharma
Rahul Sharma

Reputation: 6169

In my case problem solved using other way i.e. apply plugin. Open your build.gradle(Module: app) file and add this line to the top below the first line.

apply plugin: 'com.google.gms.google-services'

Code looks like:

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

and click on sync now. Problem solved.

Upvotes: 0

etienne
etienne

Reputation: 3206

The build tool (gradle) can't find the google_play_services library, that define the relevant classes. Update your build.gradle file, so that it finds the library (at the right path):

[EDIT 2: since 6.5, you can selectively add needed Google Play Services APIs ]

dependencies {
    compile 'com.google.android.gms:play-services-base:9.4.0'
    compile 'com.google.android.gms:play-services-XXX:9.4.0'
}

[EDIT: newer method, a 'native' support is now provided]

Open SDK Manager, download and install Google Play Services and Google Repository Edit build.gradle to add:

dependencies {
    compile 'com.google.android.gms:play-services:3.1.36'
}

[Old method]

Check that google-plays-services is a module in your project, and that its build.gradle contains:

dependencies {
    compile files('libs/google-play-services.jar')
}

In your module build.gradle:

dependencies {
     compile project(':google-play-services')
}

Upvotes: 1

Related Questions