Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio Google Play Services no autocomplete

I use AS 0.4.2 then imported GMS as described in doc: https://developer.android.com/google/play-services/setup.html

 dependencies {
     compile 'com.android.support:support-v4:19.0.0'
     compile 'com.android.support:appcompat-v7:+'
     compile 'com.android.support:support-v13:13.0.+'
     compile 'com.google.android.gms:play-services:4.0.30' }

all what is detected by IDE is R class, but rest of code is invisible. On the other hand I put following code:

import com.google.android.gms.common.GooglePlayServicesUtil;
(...)
    private void connectGms(){
        Log.d(MbcConstants.TAG,
                "check for gms"+ GooglePlayServicesUtil.
                        isGooglePlayServicesAvailable(this));
    }

And it works, but IDE still shows class name in red, but properly shows the params and returned type for method.

like image 679
piotrpo Avatar asked Mar 09 '26 21:03

piotrpo


1 Answers

Ok - it seems like a bug in Android studio. What I've done do fix it: remove all dependencies (use F4 key) from project and the module delete files from projectroot/.idea/libraries

open the module gradle.buld

add back all dependencies that are needed by your project to work. In my case:

dependencies {
    compile 'com.android.support:support-v4:19.0.0'
    compile 'com.android.support:appcompat-v7:19.0.0'
    compile 'com.google.android.gms:play-services:4.0.30'
}

Synchronize gradle.build once again

Continue your adventure of love and hate or return to eclipse.

like image 129
piotrpo Avatar answered Mar 16 '26 13:03

piotrpo