【问题标题】:Android Studio gradle sync failed to find libraryAndroid Studio gradle 同步找不到库
【发布时间】:2014-08-26 12:42:05
【问题描述】:

所以我正在开发 AndroidStudio 0.8.1 beta 中的项目,我想利用我在 github (https://github.com/derekbrameyer/android-betterpickers) 上找到的库。我像在 README.md 中所说的那样添加依赖项,但是当我尝试将项目与 gradle 文件同步时,它说:

找不到:com.doomonafireball.betterpickers:library:1.5.2

这是我的 build.gradle 文件:

apply plugin: 'com.android.application'
buildscript {
    repositories {
        maven { url 'http://repo1.maven.org/maven2' }
    }
}

repositories {
    mavenCentral()
}

android {
    compileSdkVersion 19
    buildToolsVersion '19.1.0'
    defaultConfig {
        applicationId 'gtsarandum.syncc'
        minSdkVersion 14
        targetSdkVersion 19
        versionCode 1
        versionName '1.0'
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:support-v4:19.+'
    compile project(':extendedCalendarView')
    compile project(':src')
    compile 'com.github.gabrielemariotti.cards:library:1.7.3'
    compile 'com.github.gabrielemariotti.cards:library-extra:1.7.3'
    compile 'com.doomonafireball.betterpickers:library:1.5.2'
}

上次我遇到gabriellemariotti.cards:libraryd:1.7.3 的这个问题时,我在构建脚本中添加了maven { url 'http://repo1.maven.org/maven2' },如上所示。

我还有什么要补充的吗?如果没有,我该如何解决这个问题?

非常感谢!

【问题讨论】:

    标签: android maven android-studio android-library build.gradle


    【解决方案1】:

    我的解决方法是添加:

    allprojects {
        repositories {
            mavenCentral()
        }
    }
    

    到 build.gradle 文件

    【讨论】:

    • 使用jcenter 而不是mavenCentral。 Android Stuido 的新默认存储库是jcenter
    【解决方案2】:

    尝试使用 include 语句更改“gradle.settings”以查找未找到的路径/lib。

    【讨论】:

    • 其实我只需要在 gradle 设置中关闭离线模式:|
    • @NDTS 关闭离线模式也对我有用,谢谢。 Android Studio 有时肯定会很令人沮丧..
    • 确实..离线模式可以这么牛,
    【解决方案3】:

    不要使用 HTTP 代理。 Android Studio -> 文件 -> 设置 -> HTTP 代理 -> 无代理

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-11-25
      • 1970-01-01
      • 1970-01-01
      • 2021-02-20
      • 2022-06-30
      • 2017-09-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多