java - 无法解析第三方库

标签 java android android-studio gradle

我从 https://github.com/chenyangcun/MaterialDesignExample 下载一个 Android Studio 项目。我将其添加到 Android Studio 并运行它,但出现了一些错误:

enter image description here

爆炸的是 build.gradle 文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.aswifter.materialexample"
        minSdkVersion 15
        targetSdkVersion 21
        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:design:22.2.1'
    compile 'com.android.support:appcompat-v7:22.2.1'
    compile 'com.android.support:cardview-v7:22.2.1'
    compile 'com.android.support:recyclerview-v7:22.2.1'

    compile 'com.github.bumptech.glide:glide:3.6.0'
    compile 'de.hdodenhof:circleimageview:1.3.0'

    compile 'com.loopj.android:android-async-http:1.4.7'
    compile 'com.google.code.gson:gson:2.3'
    compile 'com.afollestad:material-dialogs:0.7.6.0'
}

然后我使用相同的“第三方库”构建一个全新的 Android 项目
爆炸的是我的 bulid.gradle 文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.0"

    defaultConfig {
        applicationId "com.mummyding.app.test"
        minSdkVersion 15
        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'])
    compile 'com.android.support:appcompat-v7:23.0.0'
    compile 'com.android.support:design:22.2.1'

    compile 'com.android.support:cardview-v7:22.2.1'
    compile 'com.android.support:recyclerview-v7:22.2.1'
    compile 'com.github.bumptech.glide:glide:3.6.0'
    compile 'de.hdodenhof:circleimageview:1.3.0'

    compile 'com.loopj.android:android-async-http:1.4.7'
    compile 'com.google.code.gson:gson:2.3'
    compile 'com.afollestad:material-dialogs:0.7.6.0'
}

让我困惑的是“错误信息”:

enter image description here

在这个项目中编译'de.hdodenhof:circleimageview:1.3.0'没问题!!!
所以我的问题是:

  1. 你能运行this吗?您的 Andorid Studio 中的项目吗?

  2. 为什么“错误信息”不同?

  3. 如何解决?

PS:
Gradle 版本:2.2.1
IDE:Android Studio 1.2.1.1
操作系统:Ubuntu 15.04
我在中国,但我有一个带shadowsocks的路由器(这意味着我可以访问任何我想要的网站)
这确实让我困惑了很长一段时间,所以任何建议将不胜感激,谢谢您。

最佳答案

问题可能是您的代理设置。您可能需要在 gradle.properties 中设置以下内容(请根据您的代理设置进行修改):

systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=8123
systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=8123

关于java - 无法解析第三方库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32548312/

相关文章:

java - 无法使 CAS 单点注销与 Spring Security 一起使用

java - 将特殊字符转换为字节和字符串时出现问题

android - 在异步任务中正确实现 DbOperations

git - Android studio git 使用私钥

java - 尝试使用 kinvey 将图像从 Android 应用程序上传到云

java - 如何使用 @RestController 以纯文本形式返回简单的 boolean 值?

java - junit 测试 Iterable 的相等性

Android - 在 WebView 的 Assets 子文件夹中显示图像

android - 标题与 BottomNavigationView 中的图标重叠

git - Android Studio git commit 看不到我修改过的文件