简体   繁体   中英

Gradle dependency not working in android studio

I am migrating to work with android studio and can't seem to be able to add external libraries with Gradle build.

To start, i'm trying to add the support library and use the ViewPager.

I started a new project and added the support library to my dependencies like it says in the android studio page, this is my gradle.build file:

apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.1"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:support-v4:18.0.+'
    compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
}

When I try to use the ViewPager class in my MainActivity.java, it doesn't find the library or asks me to import it.

What am I missing here?

I'll add my answer from the comments since it might help someone else:
Try to 'clean' and rebuild your project, if it still acting up, try to make and compile the project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM