android - Gradle - 无法创建工具 API 实现的实例

标签 android android-studio gradle android-gradle-plugin gradle-tooling-api

我正在尝试从 GitHub 导入一个项目并在 Android Studio 上构建/运行它。我收到以下错误:

"Error:Could not create an instance of Tooling API implementation using the specified Gradle distribution 'https://services.gradle.org/distributions/gradle-2.4-all.zip'."



我尝试了以下方法:
  • 使缓存无效并重新启动
  • 将 gradle-wrapper/properties 中的 distributionURL 更改为 2.5 等。
  • 删除 build.gradle 并重新启动

  • 这些是我从 stackoverflow 上的其他几篇文章中得到的想法,所以我无法解释我为什么尝试这些。 (我对 Android Studio 非常陌生)。

    我的 build.gradle文件如下所示:
    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    
    buildscript {
        repositories {
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:1.5.1'
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        } }
    
    allprojects {
        repositories {
            jcenter()
        } }
    
    task clean(type: Delete) {
        delete rootProject.buildDir }
    

    最佳答案

    我遇到了类似的问题,更新 Gradle distributionUrl 中的版本解决了。
    distributionUrl此目录下存在字段:

    project-root-directory/gradle/wrapper/gradle-wrapper.properties
    

    关于android - Gradle - 无法创建工具 API 实现的实例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34599139/

    相关文章:

    Android使用requestLocationUpdates()时如何从intent获取信息

    android - 错误 : Invalid Token

    android-studio - Android Studio 2.0 即时运行不工作

    android - 不能声明占位符 View

    eclipse - 使用检测文件调试 Gradle 应用程序

    intellij-idea - 如何为 Gradle 正确配置 Kotlin 插件?

    android - 如何在 Android Jetpack Compose Text 中设置文本大小

    android - 是否可以使用标准音乐应用程序来选择音频文件?

    android - 多列 ListView 显示零而不是数据库值

    java - 无法从存储 "C:\Users\....\.android\debug.keystore": Invalid keystore format 读取 key AndroidDebugKey