错误:无法解决:android.arch.core:common:1.1.0

sha*_*eal 32 android-studio build.gradle android-gradle-plugin

我的系统突然关闭,我打开它,我得到错误:无法解决:android.arch.core:常见:我的android工作室1.1.0错误.我尝试过清理和重建项目,但它没有用.我在互联网上进行了研究,但没有一个能解决我的问题.

建立.gradle这个(项​​目)

// 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
}
Run Code Online (Sandbox Code Playgroud)

的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'
}
Run Code Online (Sandbox Code Playgroud)

我不知道问题的原因是什么.

小智 74

maven {url "https://maven.google.com"}之前通过移动来解决这个问题jcenter(),像这样:

repositories {
    maven { url "https://maven.google.com" }
    jcenter()
    maven { url 'https://jitpack.io' }
}
Run Code Online (Sandbox Code Playgroud)

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

  • 如果像我一样,你已经在你的存储库部分中有google(),只需将它移到jcenter()行上方即可.存储库{mavenCentral()google()jcenter() (6认同)

小智 10

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

但问题是你有两个build.gradle文件,你需要在两个文件中进行更改.


jka*_*ten 9

问题

在过去的几周里,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
Run Code Online (Sandbox Code Playgroud)

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

固定

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

repositories {
    google()
    jcenter()
}
Run Code Online (Sandbox Code Playgroud)

在大多数项目中,您必须在2个位置更新此项.

buildscript {
    repositories {
        google()
        jcenter()
    }

}

allprojects {
    repositories {
        google()
        jcenter()
    }
}
Run Code Online (Sandbox Code Playgroud)

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