【问题标题】:Error:Failed to resolve: android.arch.core:common:1.1.0错误:无法解决:android.arch.core:common:1.1.0
【发布时间】:2018-09-25 03:09:10
【问题描述】:

我的系统突然关闭,我打开它,我在我的 android studio 中出现 Error:Failed to resolve: android.arch.core:common:1.1.0 错误。我已经尝试过清理和重建项目,但它没有用。我在互联网上进行了研究,但没有一个可以解决我的问题。

构建。毕业(项目)

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

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

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

allprojects {
repositories {
    jcenter()
    maven {
        url 'https://jitpack.io'
    }
    maven {
        url "https://maven.google.com"
    }
}
}

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

build.gradle(App)

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
buildToolsVersion "27.0.1"
defaultConfig {
    applicationId "com.example.system2.tranxav"
    minSdkVersion 16
    targetSdkVersion 24
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner 
  "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
} 

dependencies {

compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', 
{
    exclude group: 'com.android.support', module: 'support-annotations'
})

   compile 'com.stripe:stripe-android:6.1.1'
compile 'com.stripe:stripe-java:1.47.0'
compile 'com.stripe:stripe-android:1.0.4'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
 compile 'com.android.volley:volley:1.0.0' // dependency file for Volley
compile 'com.android.support:appcompat-v7:27.0.2'
compile 'com.android.support:cardview-v7:27.1.0'
compile 'com.android.support:recyclerview-v7:27.1.0'
compile 'com.android.support:design:27.1.0'
compile 'com.basgeekball:awesome-validation:1.3'
compile 'com.parse:parse-android:1.16.5'
compile 'com.parse.bolts:bolts-tasks:1.4.0'
compile 'com.parse.bolts:bolts-applinks:1.4.0'
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services-appindexing:8.4.0'
}

我不知道问题的原因。

【问题讨论】:

  • 很好的问题格式。这就是应该在 SO 上提出问题的方式。好伙伴。
  • @shabz4real 你有没有找到解决办法?

标签: android-studio android-gradle-plugin build.gradle


【解决方案1】:

我通过将maven {url "https://maven.google.com"} 移到jcenter() 之前来解决此问题,如下所示:

repositories {
    maven { url "https://maven.google.com" }
    jcenter()
    maven { url 'https://jitpack.io' }
}

这是因为我发现jcenter()repository已经删除了android.arch.core的目录,所以我们要从"https://maven.google.com"获取这个文件(android.arch.core:common-1.1.0.jar)

【讨论】:

  • 感谢您的解决方案。由于这个问题,我真的很害怕。在机器代码上工作,但在第二个它不是......谢谢
  • 如果像我一样,您的存储库部分中已经有 google(),只需将其移至 jcenter() 行上方。存储库 { mavenCentral() google() jcenter()
  • 我遇到了同样的问题,切换 google 和 jcenter 订单为我解决了这个问题。 google() 应该在 jcenter() 之前...
  • bravo.. 解决了我的问题.. 非常感谢
  • 有人需要被解雇,无论是谁在 maven 之前移动了 jcenter()。
【解决方案2】:

问题

在过去的几周里,jcenter 上的一些 Google Android 库丢失了,导致出现类似您的错误。

示例:

Could not resolve all files for configuration ':app:debugCompileClasspath'.
Could not find common.jar (android.arch.core:common:1.1.0). Searched in the following locations:
      https://jcenter.bintray.com/android/arch/core/common/1.1.0/common-1.1.0.jar

jcenter 的 maven-metadata.xml 仍然有效,并且包含导致 gradle 假定列出的文件存在的版本,并会尝试下载它们而不回退到 https://maven.google.com/。即使您的build.gradle 中的jcenter() 下有这个或google() 下一个。

修复

在您的根build.gradle 中,确保google()之前 jcenter()

repositories {
    google()
    jcenter()
}

在大多数项目中,您必须在 2 个位置进行更新。

buildscript {
    repositories {
        google()
        jcenter()
    }

}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

注意:如果您的 Gradle 版本低于 4.0,请使用 maven { url "https://maven.google.com" } 而不是 google()

【讨论】:

    【解决方案3】:

    解决方案:在 jcenter() 之前移动 google() - 它对我有用。

    但问题是您有两个 build.gradle 文件,您需要对这两个文件进行更改。

    【讨论】:

      【解决方案4】:

      请检查代理详细信息,因为某些时间库由于代理错误而无法提取请检查gradel.property 文件

      【讨论】:

      • 您能详细说明一下吗?我必须在我的 gradle.properties 文件中检查什么?我无法摆脱这个错误。
      【解决方案5】:

      我认为是因为 androidx 库。你应该删除 Gradle.properties 中的这两行

      android.useAndroidX=true android.enableJetifier=true

      【讨论】:

        猜你喜欢
        • 2020-01-17
        • 2021-12-07
        • 2019-05-11
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-07-17
        • 2018-02-08
        • 2020-01-31
        相关资源
        最近更新 更多