Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Help! I´m a 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!!

like image 773
Hi_its_me Avatar asked Dec 07 '18 22:12

Hi_its_me


People also ask

Why is my Kotlin MPP code not compiling in Android Studio?

For example, Android Studio 4.1 Canary builds use AndroidStudioPreview4.1, instead of the AndroidStudio4.1 directory that is used for Release Candidates and Stable releases. Compilation errors may arise in Kotlin MPP code due to missing symbols. Upgrading your Kotlin plugin to version 1.4 should resolve this issue.

How to fix unknown_JVMTI_error error in Android Studio?

JVMTI error: UNKNOWN_JVMTI_ERROR To work around this issue in Android Studio 3.5, click Run to re-deploy your app and see your changes. Note: This issue ( #135172147) is fixed in Android Studio 3.6 Canary 6 and higher.

Why won't Android Studio start after upgrading to Android 11?

In the SDK Platforms tab, check the box labeled Show Package Details and select revision 9 or higher of the Android 11 emulator. If Studio doesn't start after an upgrade, the problem may be due to an invalid Android Studio configuration imported from a previous version of Android Studio or an incompatible plugin.

Why is my Gradle project not updating APKs?

Starting in Gradle 7.0, file watching is enabled by default. If you are working on Mac OS and your project is saved under /System/Volumes/Data, Gradle file watching will not properly track file changes. This will cause the Build System to not see any file changes and it will therefore not update the APK (s).


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

like image 96
Kim Kempf Avatar answered Nov 14 '22 08:11

Kim Kempf


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()
like image 40
Towfiq Avatar answered Nov 14 '22 08:11

Towfiq