简体   繁体   中英

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

Help! I´ma newbie to Android Studio and Android Programming. I did some Tutorials that worked fine. Now I tried to open an existing Android project I have to edit. 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. 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. Try changing the the project level build.gradle file:

    // 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 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.

Update improved solution: Apparently the 2.3.3 plug-in is no longer available. Changing only the dependency works for me. No need to reference the google() repository.

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

UPDATE: The missing library versions have been restored to 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. 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.

For Cordova Users

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:

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.

And then replace:

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

with:

mavenCentral()

For non Cordova users

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'

And replace

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

with

mavenCentral()

build-tools are currently at 28.0.3 ; it ordinary even should ask to fetch them (whatever version). with current Android Studio the buildTools are chosen automatically; current version is Android Studio & Gradle plugin to 3.2.1 . add Google's Maven Repository for the Java dependencies.

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. just see for yourself: https://mvnrepository.com/artifact/com.android.tools/common

you'd have to change buildTools to version 25.3.0 and add repository mavenCentral() .

UPDATE : Google has confirmed they made a mistake and pulled several packages from jcenter() that they thought (but were not) hosted on google(). They're working on restoring them to jcenter() and you can follow the progress here: 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):

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:

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. Basically, when your build encounters a failure, google the missing package, find where it's hosted now and add it to your 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.

Yesterday, the build works. Today, it doesn't. No android config changes. We're using AppCenter, so the builds there have no local cache and dependencies are re-downloaded every time. This is how the problem is masked on my local. When I ran gradle with --refresh-dependencies, I got the error.

The above makes me strongly suspect that the file basically disappeared from 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.

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. My build.gradle is using 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. like this

It looks like the package also not hosted by 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.

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. The solution maybe to upgrade you androdi build tool version.

```

Could not resolve all files for configuration ':classpath'. 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 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: 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"

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. Please let us know if you still run into any issues. 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")
  • changed the Android Plugin Version to 2.3.0 and added to the 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

  • I cosed and reopened Android Studio a few times

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. 3.2.0 and it works!

3 days working on this error but not solved yet ...

i did many changes but ... NO ...

if anyone has new idea please share it ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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