代码之家  ›  专栏  ›  技术社区  ›  Farzad

Android studio 3无法下载存储库(错误:无法下载资源的SHA1)

  •  3
  • Farzad  · 技术社区  · 9 年前

    我使用android studio 3.0.0版。

    在更新之前,我使用SDK管理器更新支持库。但是在更新android studio 3之后,我应该通过 https://dl.google.com/dl/android/maven2/ . 所以我需要支持库26.1.0。

    Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve junit:junit:4.12.
    
    Could not resolve junit:junit:4.12.
    Required by:
        project :app > com.android.support.test:runner:1.0.1
     > Could not resolve junit:junit:4.12.
        > Failed to download SHA1 for resource 'https://dl.google.com/dl/android/maven2/junit/junit/4.12/junit-4.12.pom'.
              > For input string: "<!"
    

    https://dl.google.com/dl/android/maven2/junit/junit/4.12/junit-4.12.pom ?

    我使用代理,但无法下载。

    所有依赖项库(appcampatv7、设计、注释等)都会显示此错误

    无法下载资源的SHA1 ?

    更新:

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    
    buildscript {
    
        repositories {
            google()
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.0.0'
    
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    allprojects {
        repositories {
            google()
            jcenter()
        }
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    

    和

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 26
        buildToolsVersion "26.0.2"
        defaultConfig {
            applicationId "com.example.testtesttest"
            minSdkVersion 15
            targetSdkVersion 26
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }
    
    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'com.android.support:appcompat-v7:26.1.0'
        implementation 'com.android.support.constraint:constraint-layout:1.0.2'
        implementation 'com.android.support:design:26.1.0'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.1'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    }
    
    1 回复  |  直到 9 年前
        1
  •  5
  •   Farzad    9 年前

    gradle.propertices 文件集代理两者 http 和 https 然后再次同步。

    systemProp.http.proxyHost=127.0.0.1
    systemProp.https.proxyPort=12345
    org.gradle.jvmargs=-Xmx1234m
    systemProp.https.proxyHost=127.0.0.1
    systemProp.http.proxyPort=12345