无法通过gradle安装。没有找到神器*

时间:2015-07-06 22:27:11

标签: android maven gradle

我已经尝试过解决方案(Using ViewPagerIndicator library with Android Studio and Gradle),但没有成功。仍然收到此错误消息

Error:A problem occurred configuring project ':app'.
> Artifact 'library.aar (com.viewpagerindicator:library:2.4.1)' not found.
  Searched in the following locations:
      https://repo1.maven.org/maven2/com/viewpagerindicator/library/2.4.1/library-2.4.1.aar

我尝试做的是通过gradle安装此插件(https://github.com/JakeWharton/ViewPagerIndicator)。以下是我的build.gradle

apply plugin: 'com.android.application'

repositories {
    maven { url "http://dl.bintray.com/populov/maven" }
    mavenCentral()
    maven { url 'http://download.crashlytics.com/maven' }

}

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.xxxxx.xxxxx"
        minSdkVersion 15
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.viewpagerindicator:library:2.4.1@aar'
}

1 个答案:

答案 0 :(得分:0)

添加:

repositories {
    maven {
        url "https://jitpack.io"
    }
}

之前mavenCentral()

dependencies

compile('com.github.JakeWharton:ViewPagerIndicator:2.4.1@aar') {
    exclude module: 'support-v4'
}

我想你可以错过这一行classpath 'com.android.tools.build:gradle:1.2.3'

我的傻瓜:

apply plugin: 'com.android.application'
apply plugin: 'android-apt'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.example.n1to.testapp"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/services/javax.annotation.processing.Processor'
    }
}

apt {
    arguments {
        androidManifestFile variant.outputs[0].processResources.manifestFile
        // if you have multiple outputs (when using splits), you may want to have other index than 0

        // you should set your package name here if you are using different application IDs
        // resourcePackageName "your.package.name"

        // You can set optional annotation processing options here, like these commented options:
        // logLevel 'INFO'
        // logFile '/var/log/aa.log'
    }
}


buildscript {
    repositories {
        maven { url "https://jitpack.io" }
        maven { url "http://dl.bintray.com/populov/maven" }
        mavenCentral()
    }
    dependencies {
        // replace with the current version of the Android plugin
        classpath 'com.android.tools.build:gradle:1.2.3'
        // replace with the current version of the android-apt plugin
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
    }
}

repositories {
    maven { url "https://jitpack.io" }
    maven { url "http://dl.bintray.com/populov/maven" }
    mavenCentral()
    mavenLocal()
}

dependencies {
    compile 'org.androidannotations:androidannotations:3.3.1'
    apt 'org.androidannotations:androidannotations:3.3.1'
    compile 'org.projectlombok:lombok:1.16.4'
    compile('com.android.support:appcompat-v7:22.2.0') {
        exclude module: 'support-v4'
    }
    compile('com.android.support:recyclerview-v7:22.2.0') {
        exclude module: 'support-v4'
    }
    compile('com.android.support:cardview-v7:22.2.0') {
        exclude module: 'support-v4'
    }
    compile('com.android.support:design:22.2.0') {
        exclude module: 'support-v4'
    }
    compile 'com.android.support:support-v4:22.1.1'
    compile('com.github.JakeWharton:ViewPagerIndicator:2.4.1@aar') {
        exclude module: 'support-v4'
    }
}