Top Level Build.gradle:android
buildscript { repositories { maven { url "http://dl.bintray.com/populov/maven" } mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.12.+' } } allprojects { repositories { maven { url "http://dl.bintray.com/populov/maven" } mavenCentral() } }
App's build.gradle:app
compile 'com.viewpagerindicator:library:2.4.1@aar'
To use Android-ViewPagerIndicator in Android Studio, you can’t download it from gradle. Instead, you must import the library as an 「Existing Project」 to your current one.maven
Follow these steps:gradle
1 Download source code from GitHub.ui
2 In your Android Studio Project: File -> Project Structure -> add (+ symbol) -> Import Existing Project. Import just the folder called 」library」, not the entire project (leave the import options as Android Studio suggests).url
3 If the "compileSdkVersion" specified in your build.gradle doesn’t match with the one specified in the Android-ViewPagerIndicator project, change the second one. The same apply with any other property, such as "minSdkVersion" or even the current support library.直接將App's build.gradle裏面的android{}內容複製到新導入的模塊的build.gradle中
spa
4 Add Android-ViewPagerIndicator project as a dependency to your build.gradle module:code
dependencies { compile project(':library') }