无法使用Gradle将ViewPagerIndicator添加到应用程序

Al *_*sey 12 android gradle maven viewpagerindicator android-gradle-plugin

我正在尝试将Jack Whartons ViewPagerIndicator库https://github.com/JakeWharton/ViewPagerIndicator添加 到我的应用程序中,因为我想使用我拥有的viewpager的圆形指示器.但是我无法将其添加到我的应用程序.我已经按照本教程 - 在Android Studio和Gradle中使用ViewPagerIndicator库

但是我收到了这个错误

    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
Run Code Online (Sandbox Code Playgroud)

如果我删除jCenter()我的gradle 中的代码然后它的工作原理,但我所包含的其他依赖项没有,所以我不知道如何让所有的依赖项一起工作.

这是我的顶级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()

    }
}
Run Code Online (Sandbox Code Playgroud)

这是我的模块: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'

}
Run Code Online (Sandbox Code Playgroud)

感谢您的帮助

Gab*_*tti 24

您可以检查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()

    }
}
Run Code Online (Sandbox Code Playgroud)

  • 我的天啊!!!我正在处理这一整天,我无法添加VIewPagerINdicator(使用gradle)!在网站上尝试其他答案.我会放弃.但你的回答救了我.不同的是订单!! 第一和第二行.就这样!!非常感谢 :) (5认同)
  • 它对我不起作用。有任何想法吗?我是这样的 (2认同)