Gradle 无法将 ViewPagerIndicator 添加到应用
Can't add ViewPagerIndicator to app with Gradle
我正在尝试添加 Jack Whartons ViewPagerIndicator 库 https://github.com/JakeWharton/ViewPagerIndicator
到我的应用程序,因为我想为我拥有的 viewpager 使用圆圈指示器。但是我无法将它添加到我的应用程序中。
我遵循了本教程 - Using ViewPagerIndicator library with Android Studio and Gradle
但是我收到了这个错误
Error:Artifact 'library.aar (com.viewpagerindicator:library:2.4.1)' not found.
Searched in the following locations:
https://jcenter.bintray.com/com/viewpagerindicator/library/2.4.1/library-2.4.1.aar
如果我删除 gradle 中的 jCenter()
代码,那么它可以工作,但我包含的其他依赖项不会,所以我不确定如何让所有依赖项一起工作.
这是我的顶级 gradle 文件
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven { url "http://dl.bintray.com/populov/maven" }
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "http://dl.bintray.com/populov/maven" }
mavenCentral()
}
}
这是我的 module:app gradle 文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "co.app.al.app"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.afollestad:material-dialogs:0.6.2.3'
compile files('libs/volley.jar')
compile 'uk.co.chrisjenx:calligraphy:2.0.2'
compile 'com.viewpagerindicator:library:2.4.1@aar'
}
感谢所有帮助
你可以查看maven仓库或者jcenter:
http://search.maven.org/#search%7Cga%7C1%7Ccom.viewpagerindicator
https://bintray.com/bintray/jcenter/com.viewpagerindicator%3Alibrary/view#files
2.4.1 有一个库工件,但它不是 AAR 文件。
您必须使用替代存储库
maven { url "http://dl.bintray.com/populov/maven" }
,但顺序很重要。
更改脚本:
allprojects {
repositories {
maven { url "http://dl.bintray.com/populov/maven" }
jcenter()
mavenCentral()
}
}
我正在尝试添加 Jack Whartons ViewPagerIndicator 库 https://github.com/JakeWharton/ViewPagerIndicator 到我的应用程序,因为我想为我拥有的 viewpager 使用圆圈指示器。但是我无法将它添加到我的应用程序中。 我遵循了本教程 - Using ViewPagerIndicator library with Android Studio and Gradle
但是我收到了这个错误
Error:Artifact 'library.aar (com.viewpagerindicator:library:2.4.1)' not found.
Searched in the following locations:
https://jcenter.bintray.com/com/viewpagerindicator/library/2.4.1/library-2.4.1.aar
如果我删除 gradle 中的 jCenter()
代码,那么它可以工作,但我包含的其他依赖项不会,所以我不确定如何让所有依赖项一起工作.
这是我的顶级 gradle 文件
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven { url "http://dl.bintray.com/populov/maven" }
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "http://dl.bintray.com/populov/maven" }
mavenCentral()
}
}
这是我的 module:app gradle 文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "co.app.al.app"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.afollestad:material-dialogs:0.6.2.3'
compile files('libs/volley.jar')
compile 'uk.co.chrisjenx:calligraphy:2.0.2'
compile 'com.viewpagerindicator:library:2.4.1@aar'
}
感谢所有帮助
你可以查看maven仓库或者jcenter:
http://search.maven.org/#search%7Cga%7C1%7Ccom.viewpagerindicator
https://bintray.com/bintray/jcenter/com.viewpagerindicator%3Alibrary/view#files
2.4.1 有一个库工件,但它不是 AAR 文件。
您必须使用替代存储库
maven { url "http://dl.bintray.com/populov/maven" }
,但顺序很重要。
更改脚本:
allprojects {
repositories {
maven { url "http://dl.bintray.com/populov/maven" }
jcenter()
mavenCentral()
}
}