将android支持库v4 r13添加到我的android项目中

时间:2016-12-10 23:21:08

标签: android gradle android-support-library dependency-management

我尝试在我的android项目中添加以下库作为依赖项:

compile 'com.thehayro:infiniteviewpager:0.4'

在构建时给出了以下gradle错误:

A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
   > Could not find com.google.android:support-v4:r13.
     Searched in the following locations:
         https://jcenter.bintray.com/com/google/android/support-v4/r13/support-v4-r13.pom
         https://jcenter.bintray.com/com/google/android/support-v4/r13/support-v4-r13.jar
         https://repo1.maven.org/maven2/com/google/android/support-v4/r13/support-v4-r13.pom
         https://repo1.maven.org/maven2/com/google/android/support-v4/r13/support-v4-r13.jar
         file:/C:/Users/Henrykvdb/AppData/Local/Android/android-sdk/extras/android/m2repository/com/google/android/support-v4/r13/support-v4-r13.pom
         file:/C:/Users/Henrykvdb/AppData/Local/Android/android-sdk/extras/android/m2repository/com/google/android/support-v4/r13/support-v4-r13.jar
         file:/C:/Users/Henrykvdb/AppData/Local/Android/android-sdk/extras/google/m2repository/com/google/android/support-v4/r13/support-v4-r13.pom
         file:/C:/Users/Henrykvdb/AppData/Local/Android/android-sdk/extras/google/m2repository/com/google/android/support-v4/r13/support-v4-r13.jar
     Required by:           
         xkcdexplain:app:unspecified
         xkcdexplain:app:unspecified > com.thehayro:infiniteviewpager:0.4

我尝试手动添加android支持库并使用android sdk manager安装它,但这些都没有用。 我还读过一些地方,我可以尝试为库找到一个下载并手动添加它,但必须有一个更优雅的方式。

的build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "25.0.0"

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

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:design:23.4.0'
    compile 'org.jsoup:jsoup:1.10.1'
    compile 'com.google.code.gson:gson:2.7'
    compile 'com.thehayro:infiniteviewpager:0.4'
}

global / top-level build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.0.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        mavenCentral()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

0 个答案:

没有答案