-1

我已经安装了最新版本的 Android Support Repository (47.0.0),但由于以下错误,我无法构建我的项目。

错误

这是我的 build.gardle 代码

compileSdkVersion 26
buildToolsVersion '26.0.1'
defaultConfig {
    applicationId "ir.dones.dones"
    minSdkVersion 17
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary= true
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}


compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

依赖关系

implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.3-alpha', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:support-compat:26.0.0'
implementation 'com.android.support:support-v4:26.0.0'
implementation 'com.android.support:appcompat-v7:26.0.0'
implementation 'com.android.support:support-core-utils:26.0.0'
implementation 'com.android.support:design:26.0.0'
implementation 'com.android.support:support-vector-drawable:26.0.0'
implementation 'com.android.support:recyclerview-v7:26.0.0'
implementation 'com.android.support:cardview-v7:26.0.0'
implementation 'com.getbase:floatingactionbutton:1.10.1'
implementation 'com.google.code.gson:gson:2.8.1'
implementation 'de.hdodenhof:circleimageview:2.1.0'
implementation "at.blogc:expandabletextview:1.0.3"
testImplementation "junit:junit:4.12"

我已经按照 Android Studio 的建议将支持库升级到 26.0.2 版本,但我知道没有发布这样的版本。

Android Studio 建议

再次这样做我遇到了同样的错误。我在存储库中尝试了 google() 和 maven() 但也没有帮助。将支持版本更改为 26.+ 是我构建项目的唯一方法,但这样我就不能在 Api<26 中使用 Xml 中的字体等新功能。

我正在使用 Android Studio Canary 8。

任何帮助,将不胜感激。

4

3 回答 3

2

检查你的 build.gradle。你应该有谷歌回购:

allprojects {
    repositories {
        google()
        jcenter()
    }
}
于 2017-07-31T08:30:06.507 回答
1

毕竟这是一个代理问题。我不得不用以下行替换 gradle.properties 中的默认行:

org.gradle.jvmargs=-DsocksProxyHost=127.0.0.1 -DsocksProxyPort=9090

我花了一周的时间才找到它。感谢那些回答或评论并试图提供帮助的人。

于 2017-08-01T08:58:53.547 回答
0

从错误中无法解决任何库。所以我认为问题在于您的 Maven 无法访问存储库。这可能是因为网络不好或配置不正确。

我会检查 Maven 存储库配置:

allprojects {
    repositories {
        jcenter()
        mavenLocal()

或者

试试这个:

repositories {
   jcenter {
       url "http://jcenter.bintray.com/"
   }
}
于 2017-07-31T08:39:16.753 回答