简体   繁体   English

无法运行现有的Android Project com.android.tools:common:25.3.3

[英]Cannot run existing Android Project com.android.tools:common:25.3.3

Help! 救命! I´ma newbie to Android Studio and Android Programming. 我是Android Studio和Android编程的新手。 I did some Tutorials that worked fine. 我做了一些工作正常的教程。 Now I tried to open an existing Android project I have to edit. 现在我尝试打开一个我必须编辑的现有Android项目。 I´m not even sure which file I need to open, I´ve chosen the one called "app" but the folder structure looks a little different. 我甚至不确定我需要打开哪个文件,我选择了一个名为“app”的文件,但文件夹结构看起来有点不同。 Now I can´t run the app, it seems it fails to build it. 现在我无法运行该应用程序,似乎无法构建它。 This is the error code I get: 这是我得到的错误代码:

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

I´ve noticed that the requested files don´t even exist in the link. 我注意到请求的文件甚至不存在于链接中。 How do I solve this? 我该如何解决这个问题? Thank you for your answers!! 谢谢您的回答!!

I just ran into the exact same problem. 我刚遇到了同样的问题。 The key point for you is that you are doing an initial import of a project and it appears to have a problem with the Gradle version being used by that particular project. 关键在于您正在对项目进行初始导入,并且该特定项目使用的Gradle版本似乎存在问题。 Try changing the the project level build.gradle file: 尝试更改项目级build.gradle文件:

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

buildscript {
    repositories {
        google() <-- added
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'

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

allprojects {
    repositories {
        google()  <-- added
        jcenter()
    }
}

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

Resync the project Gradle files which will fail and offer to upgrade the Gradle plug-in: 重新同步项目Gradle文件,这些文件将失败并提供升级Gradle插件:

Gradle DSL method not found: 'google()'
Possible causes:<ul><li>The project 'SampleApplication' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0).
Upgrade plugin to version 3.2.0 and sync project</li><li>The project 'SampleApplication' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper file</li><li>The build file may be missing a Gradle plugin.
Apply Gradle plugin</li>

When I upgrade the Gradle plug-in to the offered version and build tools version the project builds fine for me. 当我将Gradle插件升级到提供的版本和构建工具版本时,项目对我来说很好。

Update improved solution: Apparently the 2.3.3 plug-in is no longer available. 更新改进的解决方案:显然2.3.3插件不再可用。 Changing only the dependency works for me. 只更改依赖项对我有用。 No need to reference the google() repository. 无需引用google()存储库。

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

UPDATE: The missing library versions have been restored to jcenter(). 更新:缺少的库版本已恢复为jcenter()。 The problem in the question no longer needs this workaround. 问题中的问题不再需要此解决方法。

Been struggling with this the whole day. 一整天都在苦苦挣扎。 This was happening for a fresh cordova android project. 这是一个新的cordova android项目。 The issue was that the version 25.2.3 of the android build tools has been removed from all the repos(not sure why) but you can still get version 25.3.0 from mavenCentral. 问题是android构建工具的版本25.2.3已从所有repos中删除(不确定原因)但你仍然可以从mavenCentral获得版本25.3.0。

For Cordova Users 对于Cordova用户

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 the platforms/android/ folder and and make the above change in this file too. 然后打开build.gradle文件中的platforms/android/文件夹,并在此文件中进行上述更改。

And then replace: 然后替换:

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

with: 有:

mavenCentral()

For non Cordova users 对于非Cordova用户

Find all the build.gradle files and replace com.android.tools.build:gradle:2.2.3 with: 'com.android.tools.build:gradle:2.3.0' 找到所有的build.gradle文件,并替换com.android.tools.build:gradle:2.2.3有:“com.android.tools.build:gradle:2.3.0”

And replace 并替换

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

with

mavenCentral()

build-tools are currently at 28.0.3 ; 构建工具目前为28.0.3 ; it ordinary even should ask to fetch them (whatever version). 普通甚至应该要求获取它们(无论版本)。 with current Android Studio the buildTools are chosen automatically; 使用当前的Android Studio,自动选择buildTools ; current version is Android Studio & Gradle plugin to 3.2.1 . 当前版本是3.2.1 Android Studio&Gradle插件。 add Google's Maven Repository for the Java dependencies. 为Java依赖项添加Google的Maven存储库

update : there isn't even any version 25.3.3 but only version 25.3.0 ... only since version 26.0.0 they are available from the Google Maven repository. 更新 :竟然没有任何版本25.3.3 ,但只有版本25.3.0 ......只因为版本26.0.0它们都可以从谷歌Maven仓库。 just see for yourself: https://mvnrepository.com/artifact/com.android.tools/common 亲自看看: https//mvnrepository.com/artifact/com.android.tools/common

you'd have to change buildTools to version 25.3.0 and add repository mavenCentral() . 您必须将buildTools更改为版本25.3.0并添加存储库mavenCentral()

UPDATE : Google has confirmed they made a mistake and pulled several packages from jcenter() that they thought (but were not) hosted on google(). 更新 :Google已经确认他们犯了一个错误并从jcenter()中提取了几个他们认为(但没有)托管在google()上的软件包。 They're working on restoring them to jcenter() and you can follow the progress here: https://issuetracker.google.com/issues/120759347 他们正在努力将它们恢复到jcenter(),您可以按照以下步骤进行操作: https ://issuetracker.google.com/issues/120759347

Several packages were impacted, so our workaround was multiple parts. 有几个软件包受到影响,因此我们的解决方案是多个部分。 To fix individual package dependencies, we added this to end of our android/build.gradle file (note our four affected packages and adjust for your cases): 为了修复单个包依赖项,我们将其添加到android / build.gradle文件的末尾(请注意我们的四个受影响的包并根据您的情况进行调整):

subprojects {project ->
    if (
        project.name.contains('pushwoosh-react-native-plugin') ||
        project.name.contains('react-native-immersive') ||
        project.name.contains('react-native-shimmer') ||
        project.name.contains('react-native-vector-icons')

    ) {
        buildscript {
            repositories {
                maven { url = "https://dl.bintray.com/android/android-tools/" }
            }
        }
    }
}

For repo problems with build tools, we had to add these to android/build.grade, under buildscript.repository section: 对于构建工具的repo问题,我们必须将这些添加到builds / build.grade存放区下的android / build.grade:

maven { url 'https://dl.bintray.com/android/android-tools' }
maven { url 'https://google.bintray.com/exoplayer/' }

We also had to add the exoplayer repo to android/build.grade allprojects.repositories section. 我们还必须将exoplayer repo添加到android / build.grade allprojects.repositories部分。 Basically, when your build encounters a failure, google the missing package, find where it's hosted now and add it to your build.gradle. 基本上,当您的构建遇到失败时,请搜索缺少的软件包,找到它现在托管的位置并将其添加到build.gradle中。 I get the impression the broken repos will be fixed in a few days. 我得到的印象是破损的回购将在几天后修复。 But many of us don't have a few days. 但我们许多人没有几天。
(end update) (最后更新)



I've got the exact same problem. 我有完全相同的问题。 While I'm not super-familiar with gradle, I've been maintaining a project for a few months now. 虽然我对gradle并不熟悉,但我已经维持了几个月的项目。

Yesterday, the build works. 昨天,构建工作。 Today, it doesn't. 今天,它没有。 No android config changes. 没有android配置更改。 We're using AppCenter, so the builds there have no local cache and dependencies are re-downloaded every time. 我们正在使用AppCenter,因此那里的构建没有本地缓存​​,每次都会重新下载依赖项。 This is how the problem is masked on my local. 这就是我本地掩盖问题的方法。 When I ran gradle with --refresh-dependencies, I got the error. 当我使用--refresh-dependencies运行gradle时,我收到了错误。

The above makes me strongly suspect that the file basically disappeared from jcenter/bintray. 上面让我强烈怀疑该文件基本上从jcenter / bintray中消失了。

I don't know enough about this stuff to be certain or how to check. 我不太清楚这些东西是否确定或如何检查。 For now, I'm stuck trying to figure out how to force gradle to pull the library (com.android.tools:common:25.3.3) from somewhere that it does currently exist. 现在,我一直试图弄清楚如何强制gradle从它当前存在的某个地方拉出库(com.android.tools:common:25.3.3)。

I don't know about your situation, but I can't just update to a new version of gradle (since 2.3.3 version is causing depencency) because it's a lower dependency that is pulling gradle 2.3.3 in the first place. 我不知道你的情况,但我不能只更新到新版本的gradle(因为2.3.3版本导致了依赖性),因为它是一个较低的依赖,它首先拉动gradle 2.3.3。 My build.gradle is using com.android.tools.build:gradle:3.1.4. 我的build.gradle使用的是com.android.tools.build:gradle:3.1.4。

I know this isn't an answer, but hopefully it'll lead someone else to find the answer. 我知道这不是一个答案,但希望它能引导别人找到答案。

You should install Android SDK Build Tools 25.3.3 via Android SDK. 您应该通过Android SDK安装Android SDK Build Tools 25.3.3。 like this 这样

It looks like the package also not hosted by google(). 看起来这个包也不是由google()托管的。 If you declare jcenter() in front of google(), the request should fall back to google() unless it got some meatadata from jcenter that declares it has it. 如果你在google()前面声明了jcenter(),那么请求应该回到google(),除非它从jcenter获得了一些声明它拥有它的数据库。

You can see see from the output below that even if the request falls back to google(), it still could not find the dependency package. 您可以从下面的输出中看到,即使请求回退到google(),它仍然无法找到依赖包。 The solution maybe to upgrade you androdi build tool version. 解决方案可能是升级你的androdi构建工具版本。

``` ```

Could not resolve all files for configuration ':classpath'. 无法解析配置':classpath'的所有文件。 Could not find com.android.tools:common:25.3.3. 找不到com.android.tools:common:25.3.3。 Searched in the following locations: https://jcenter.bintray.com/com/android/tools/common/25.3.3/common-25.3.3.pom https://jcenter.bintray.com/com/android/tools/common/25.3.3/common-25.3.3.jar https://dl.google.com/dl/android/maven2/com/android/tools/common/25.3.3/common-25.3.3.pom https://dl.google.com/dl/android/maven2/com/android/tools/common/25.3.3/common-25.3.3.jar Required by: project : > com.android.tools.build:gradle:2.3.3 > com.android.tools.build:gradle-core:2.3.3 > com.android.tools.build:builder:2.3.3 project : > com.android.tools.build:gradle:2.3.3 > com.android.tools.build:gradle-core:2.3.3 > com.android.tools.build:builder:2.3.3 > com.android.tools.build:manifest-merger:25.3.3 project : > com.android.tools.build:gradle:2.3.3 > com.android.tools.build:gradle-core:2.3.3 > com.android.tools.build:builder:2.3.3 > com.android.tools.ddms:ddmlib:25.3.3 project : > com.android.tools.build:gradle:2.3.3 > com.android.tools.build:gradle-core:2.3.3 > com.android.tools.build:builder: 在以下位置搜索: https//jcenter.bintray.com/com/android/tools/common/25.3.3/common-25.3.3.pom https://jcenter.bintray.com/com/android/tools /common/25.3.3/common-25.3.3.jar https://dl.google.com/dl/android/maven2/com/android/tools/common/25.3.3/common-25.3.3.pom https ://dl.google.com/dl/android/maven2/com/android/tools/common/25.3.3/common-25.3.3.jar必需:project:> com.android.tools.build:gradle: 2.3.3> com.android.tools.build:gradle-core:2.3.3> com.android.tools.build:builder:2.3.3 project:> com.android.tools.build:gradle:2.3.3> com.android.tools.build:gradle-core:2.3.3> com.android.tools.build:builder:2.3.3> com.android.tools.build:manifest-merger:25.3.3 project:> com。 android.tools.build:gradle:2.3.3> com.android.tools.build:gradle-core:2.3.3> com.android.tools.build:builder:2.3.3> com.android.tools.ddms: ddmlib:25.3.3 project:> com.android.tools.build:gradle:2.3.3> com.android.tools.build:gradle-core:2.3.3> com.android.tools.build:builder: 2.3.3 > com.android.tools.analytics-library:shared:25.3.3 project : > com.android.tools.build:gradle:2.3.3 > com.android.tools.build:gradle-core:2.3.3 > com.android.tools.build:builder:2.3.3 > com.android.tools.analytics-library:tracker:25.3.3 project : > com.android.tools.build:gradle:2.3.3 > com.android.tools.build:gradle-core:2.3.3 > com.android.tools.build:builder:2.3.3 > com.android.tools:sdklib:25.3.3 > com.android.tools.layoutlib:layoutlib-api:25.3.3 project : > com.android.tools.build:gradle:2.3.3 > com.android.tools.build:gradle-core:2.3.3 > com.android.tools.build:builder:2.3.3 > com.android.tools:sdklib:25.3.3 > com.android.tools:dvlib:25.3.3 project : > com.android.tools.build:gradle:2.3.3 > com.android.tools.build:gradle-core:2.3.3 > com.android.tools.build:builder:2.3.3 > com.android.tools:sdklib:25.3.3 > com.android.tools:repository:25.3.3 ``` 2.3.3> com.android.tools.analytics-library:shared:25.3.3 project:> com.android.tools.build:gradle:2.3.3> com.android.tools.build:gradle-core:2.3。 3> com.android.tools.build:builder:2.3.3> com.android.tools.analytics-library:tracker:25.3.3 project:> com.android.tools.build:gradle:2.3.3> com。 android.tools.build:gradle-core:2.3.3> com.android.tools.build:builder:2.3.3> com.android.tools:sdklib:25.3.3> com.android.tools.layoutlib:layoutlib- api:25.3.3 project:> com.android.tools.build:gradle:2.3.3> com.android.tools.build:gradle-core:2.3.3> com.android.tools.build:builder:2.3。 3> com.android.tools:sdklib:25.3.3> com.android.tools:dvlib:25.3.3 project:> com.android.tools.build:gradle:2.3.3> com.android.tools.build: gradle-core:2.3.3> com.android.tools.build:builder:2.3.3> com.android.tools:sdklib:25.3.3> com.android.tools:repository:25.3.3```

I´ve chosen the one called "app" 我选择了一个名为“app”的人

But You need to open by choose directory higher in the hierarchy 但是您需要通过选择层次结构中较高的目录来打开 在此输入图像描述

The issue is now resolved, and the packages should be available on jcenter() as before. 问题现在已经解决,并且包应该像以前一样在jcenter()上可用。 Please let us know if you still run into any issues. 如果您仍然遇到任何问题,请告诉我们。 https://issuetracker.google.com/issues/120759347#comment97 https://issuetracker.google.com/issues/120759347#comment97

I finally made it and don´t really know what finally helped because I made so many steps in between but if someone else comes to this point, this might help: 我终于做到了,并且真的不知道最终有什么帮助,因为我之间做了很多步骤,但如果有其他人来到这一点,这可能会有所帮助:

  • I opened the higher-level File (not just "app") 我打开了更高级别的文件(不只是“app”)
  • changed the Android Plugin Version to 2.3.0 and added to the build.gradle: 将Android插件版本更改为2.3.0并添加到build.gradle:

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

  • I installed the latest Version of SDK Build Tools 我安装了最新版本的SDK Build Tools

  • I cosed and reopened Android Studio a few times 我几次关闭和重新打开Android Studio

suddenly it stopped asking for the non-existing version and proposed to update the packages. 突然它停止询问不存在的版本并建议更新软件包。 after a few steps of installing packages I know have gradle vers 4.6, plugin Vers. 经过几个步骤安装包后,我知道有gradle vers 4.6,插件Vers。 3.2.0 and it works! 3.2.0,它的工作原理!

3 days working on this error but not solved yet ... 处理此错误3天但尚未解决...

i did many changes but ... NO ... 我做了很多改变但是......不......

if anyone has new idea please share it ... 如果有人有新想法请分享...

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

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