Top level Build.gradle:
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:
compile ‘com.viewpagerindicator:library:[email protected]‘
To use Android-viewpagerindicator in Android Studio, you can ' t download it from Gradle. Instead, you must import the library as a "Existing Project" to your current one.
Follow these steps:
1 Download source code from GitHub.
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).
3 If the "compilesdkversion" specified in your build.gradle doesn ' t match with the one specified in the Android-viewpageri Ndicator Project, change the second one. The same is the such as "minsdkversion" or even the current support library.直接将App‘s build.gradle里面的android{}内容复制到新导入的模块的build.gradle中
4 ADD Android-viewpagerindicator Project as a dependency to your Build.gradle module:
dependencies {compile project(‘:library‘)}
5 Sync project with Gradle files.
Import GitHub Viewpagerindicator project to Android Studio