我正在处理 ViewPager 项目,但无法从 Jake Wharton 导入库:https://github.com/JakeWharton/Android-ViewPagerIndicator
我知道我需要将此代码添加到我的 build.gradle 中:
repositories {
maven { url "http://dl.bintray.com/populov/maven" }
mavenCentral()
}
和
dependencies {
// ...
compile 'com.viewpagerindicator:library:2.4.1@aar'
// ...
}
但是我在构建gradle的时候遇到了一个错误:
Gradle 'ViewPager' project refresh failed: Artifact 'com.viewpagerindicator:library:2.4.1:library.aar' not found
这是我的完整成绩:
apply plugin: 'android'
repositories {
mavenCentral()
maven { url 'http://dl.bintray.com/populov/maven' }
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "com.android.support:support-v4:19.0.+"
compile 'com.viewpagerindicator:library:2.4.1@aar'
}
我做错了什么?
提前谢谢大家!
最佳答案
说明位于 https://bintray.com/populov/maven/com.viewpagerindicator:library/view/release有问题的解决方案:
In your build.gradle include http://dl.bintray.com/populov/maven as a repository before mavenCentral:
repositories {
maven { url "http://dl.bintray.com/populov/maven" }
mavenCentral()
}
Use in your project dependencies as usual:
dependencies {
compile 'com.viewpagerindicator:library:2.4.1@aar'
}
Why prior to mavenCentral?
Otherwise gradle will look first in mavenCentral, find viewpagerindicator artifact with the same version, but won't find aar package and will report an error, without looking for same artifact with another packaging in other repositories.
关于android - 无法使用 Android Studio 导入 ViewPagerIndicator 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25938961/