Android Can';t使用渐变将ViewPagerIndicator添加到应用程序
我正在尝试添加Jack Whartons ViewPagerIndicator库 当我想使用viewpager的圆圈指示器时,请转到我的应用程序。但是,我在将其添加到我的应用程序时遇到问题。 我遵循了本教程- 然而,我得到了这个错误Android Can';t使用渐变将ViewPagerIndicator添加到应用程序,android,maven,gradle,android-gradle-plugin,viewpagerindicator,Android,Maven,Gradle,Android Gradle Plugin,Viewpagerindicator,我正在尝试添加Jack Whartons ViewPagerIndicator库 当我想使用viewpager的圆圈指示器时,请转到我的应用程序。但是,我在将其添加到我的应用程序时遇到问题。 我遵循了本教程- 然而,我得到了这个错误 Error:Artifact 'library.aar (com.viewpagerindicator:library:2.4.1)' not found. Searched in the following locations: https://j
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()
}
}
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'
}
这是我的模块:appgradle文件
// 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()
}
}
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: 有一个2.4.1版本的库工件,但它不是AAR文件。 你必须使用替代回购协议
maven{url”http://dl.bintray.com/populov/maven“}
,但顺序很重要
更改脚本:
allprojects {
repositories {
maven { url "http://dl.bintray.com/populov/maven" }
jcenter()
mavenCentral()
}
}
@MLProgrammer CiM的可能重复项它不是重复项。当您的存储库顺序错误,但其他所有内容都与获取ViewPagerIndicator AAR库导入时的情况相同时,就会出现此问题。这对我不起作用。有什么想法吗?我就是这样的!!!我一整天都在处理这个问题,我无法添加VIewPagerINdicator(使用gradle)!!在网站上尝试其他答案。我本来打算放弃的。但是你的回答救了我。区别在于顺序!!第一和第二行。这就是全部!!非常感谢:)