ray
ray

Reputation: 2045

Can't import RecyclerView after adding the support library to build.gradle & syncing project

I'm using Android Studio Beta 6, and I've added the RecyclerView support lib to the end of my build.gradle. My app is already running fine, I just need to use the RecyclerView now.

Here's build.gradle:

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 21
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
        addCustomFieldsToBuildConfig(release)
        addCustomFieldsToBuildConfig(debug)
    }
}

dependencies {
    // ...
    compile 'joda-time:joda-time:2.1'
    compile 'com.google.android.gms:play-services-ads:+'
    compile 'com.google.android.gms:play-services-analytics:+'
    compile 'com.android.support:support-v13:21+'
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'
    compile files('libs/com_nineoldandroids.jar')
    compile files('libs/comscore.jar')
    compile files('libs/crittercism_v2_1_7_crashonly.jar')
    compile files('libs/urbanairship-lib-1.0.1.jar')
    compile files('libs/adobeMobileLibrary-4.8.1.jar')
    compile "commons-io:commons-io:2.4"
    compile 'org.jsoup:jsoup:1.8.3'

    // I WANT TO ADD THESE:
    compile 'com.android.support:appcompat-v7:21.+'
    compile 'com.android.support:recyclerview-v7:21.+'
}

I've tried specific versions of RecyclerView such as '21.0.2' but they all result in the same issue. I ask Android Studio to sync the gradle settings, and there are no errors.

But as you can see, I can't autocomplete the v7 after support:

Upvotes: 0

Views: 1951

Answers (1)

ray
ray

Reputation: 2045

In the event that this will help someone in a similar situation with Android Studio, but I had to go to Build -> Make Project before it was able to resolve references to the RecyclerView class.

Upvotes: 2

Related Questions