无法运行现有的 Android 项目 com.android.tools:common:25.3.3 [英] Cannot run existing Android Project com.android.tools:common:25.3.3

查看:24
本文介绍了无法运行现有的 Android 项目 com.android.tools:common:25.3.3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

帮助!我是 Android Studio 和 Android 编程的新手.我做了一些效果很好的教程.现在我尝试打开一个必须编辑的现有 Android 项目.我什至不确定我需要打开哪个文件,我选择了一个名为app"的文件,但文件夹结构看起来有点不同.现在我无法运行该应用程序,它似乎无法构建它.这是我得到的错误代码:

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!!

推荐答案

我刚刚遇到了完全相同的问题.对您而言,关键在于您正在对项目进行初始导入,并且该特定项目使用的 Gradle 版本似乎存在问题.尝试更改项目级别的 build.gradle 文件:

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
}

重新同步项目 Gradle 文件,该文件将失败并提供升级 Gradle 插件:

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>

当我将 Gradle 插件升级到提供的版本和构建工具版本时,项目构建对我来说很好.

When I upgrade the Gradle plug-in to the offered version and build tools version the project builds fine for me.

更新改进的解决方案: 显然 2.3.3 插件不再可用.仅更改依赖项对我有用.无需引用 google() 存储库.

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'

更新:缺失的库版本已恢复到 jcenter().问题中的问题不再需要此解决方法.

UPDATE: The missing library versions have been restored to jcenter(). The problem in the question no longer needs this workaround.

这篇关于无法运行现有的 Android 项目 com.android.tools:common:25.3.3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆