简体   繁体   English

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

[英]Could not find com.android.tools:common:25.2.3

I have set up the environment for compiling a Cordova Android app on my desktop and everything has worked fine. 我已经设置了用于在桌面上编译Cordova Android应用程序的环境,并且一切正常。 Then I compiled it on my laptop and I can't get it to compile the app. 然后,我在笔记本电脑上对其进行了编译,但无法编译该应用程序。

I get this error 我得到这个错误

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

and this is my build.gradle 这是我的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'
}

For Cordova Users 对于Cordova用户

Been struggling with this the whole day. 整天都在为此苦苦挣扎。 This was happening for fresh cordova android project. 这是在新鲜的cordova android项目中发生的。 Here is how I fixed it: 这是我的解决方法:

From your project folder navigate to platforms/android/cordovaLib and open up the build.gradle file and replace this line: 在您的项目文件夹中,导航到platforms/android/cordovaLib并打开build.gradle文件并替换以下行:

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

with: 有:

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

Then open up the build.gradle file from the platforms/android/ folder and make the above change too. 然后从platforms/android/文件夹打开build.gradle文件,并进行上述更改。 And then replace: 然后替换:

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

with: 有:

mavenCentral()

I had same problem. 我有同样的问题。 Someone has removed the 25.2.3 jar/pom from jcenter repository. 有人从jcenter存储库中删除了25.2.3 jar / pom。

I did a temporary fix by using gradle 3.1.4 instead of 2.2.3 and adding google() to the repository as below: 我通过使用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'
}

My problem was with react-native-image-picker. 我的问题是反应本机图像选择器。 I found a fix on their github as follows, in the build gradle of react-native-image-picker in the node modules folder: 我在node modules文件夹中的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 https://github.com/react-native-community/react-native-image-picker/issues/999

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM