找不到com.android.tools:common:25.2.3

时间:2018-12-08 01:44:16

标签: android cordova gradle android-gradle build.gradle

我已经设置了在桌面上编译Cordova Android应用程序的环境,并且一切正常。然后我在笔记本电脑上对其进行了编译,但无法编译该应用程序。

我收到此错误

Could not find com.android.tools:common:25.2.3.
Searched in the following locations:
    https://jcenter.bintray.com/com/android/tools/common/25.2.3/common-25.2.3.pom
    https://jcenter.bintray.com/com/android/tools/common/25.2.3/common-25.2.3.jar
    https://maven.google.com/com/android/tools/common/25.2.3/common-25.2.3.pom
    https://maven.google.com/com/android/tools/common/25.2.3/common-25.2.3.jar
Required by:
    project : > com.android.tools.build:gradle:2.2.3 > com.android.tools.build:gradle-core:2.2.3 > com.android.tools.build:builder:2.2.3
    project : > com.android.tools.build:gradle:2.2.3 > com.android.tools.build:gradle-core:2.2.3 > com.android.tools.build:builder:2.2.3 > com.android.tools.build:manifest-merger:25.2.3
    project : > com.android.tools.build:gradle:2.2.3 > com.android.tools.build:gradle-core:2.2.3 > com.android.tools.build:builder:2.2.3 > com.android.tools.ddms:ddmlib:25.2.3
    project : > com.android.tools.build:gradle:2.2.3 > com.android.tools.build:gradle-core:2.2.3 > com.android.tools.build:builder:2.2.3 > com.android.tools.analytics-library:shared:25.2.3
    project : > com.android.tools.build:gradle:2.2.3 > com.android.tools.build:gradle-core:2.2.3 > com.android.tools.build:builder:2.2.3 > com.android.tools.analytics-library:tracker:25.2.3
    project : > com.android.tools.build:gradle:2.2.3 > com.android.tools.build:gradle-core:2.2.3 > com.android.tools.build:builder:2.2.3 > com.android.tools:sdklib:25.2.3 > com.android.tools.layoutlib:layoutlib-api:25.2.3
    project : > com.android.tools.build:gradle:2.2.3 > com.android.tools.build:gradle-core:2.2.3 > com.android.tools.build:builder:2.2.3 > com.android.tools:sdklib:25.2.3 > com.android.tools:dvlib:25.2.3
    project : > com.android.tools.build:gradle:2.2.3 > com.android.tools.build:gradle-core:2.2.3 > com.android.tools.build:builder:2.2.3 > com.android.tools:sdklib:25.2.3 > com.android.tools:repository:25.2.3

这是我的build.gradle

apply plugin: 'com.android.application'

buildscript {
  repositories {
    jcenter()
    maven { url 'https://maven.google.com' }
  }


    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
    }
}

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

task wrapper(type: Wrapper) {
    gradleVersion = '2.14.1'
}

3 个答案:

答案 0 :(得分:5)

对于Cordova用户

整天都在为此苦苦挣扎。这是在新鲜的cordova android项目中发生的。这是我的解决方法:

从项目文件夹导航至platforms/android/cordovaLib,然后打开build.gradle文件并替换以下行:

classpath 'com.android.tools.build:gradle:2.2.3'

具有:

classpath 'com.android.tools.build:gradle:2.3.0'

然后从platforms/android/文件夹中打开build.gradle文件,并进行上述更改。然后替换:

 maven {
     url "https://maven.google.com"
 }

具有:

mavenCentral()

答案 1 :(得分:1)

我有同样的问题。有人从jcenter存储库中删除了25.2.3 jar / pom。

我通过使用gradle 3.1.4(而不是2.2.3)并将google()添加到存储库中进行了临时修复,如下所示:

apply plugin: 'com.android.application'

buildscript {
  repositories {
    google()
    jcenter()
    maven { url 'https://maven.google.com' }
  }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'
    }
}

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

task wrapper(type: Wrapper) {
    gradleVersion = '2.14.1'
}

答案 2 :(得分:0)

我的问题是react-native-image-picker。我在节点模块文件夹中的react-native-image-picker的构建包中找到了关于他们的github的修复程序,如下所示:

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'
    }
}

https://github.com/react-native-community/react-native-image-picker/issues/999