android - 错误 :Cause: buildToolsVersion is not specified in build. 等级(项目:xxx)

标签 android gradle configuration twitter-fabric build-tools

现在我正在尝试将 Fabric 与 Crashlytics ( https://docs.fabric.io/android/fabric/integration.html ) 集成到现有的 android 应用程序中。

按照 Fabric 提供的集成说明,我将 apply plugin: 'com.android.application' 添加到我的“build.grade (Project.NumenuApp)”文件的根目录中。我点击 Sync Gradle,它失败了,我收到此错误 Error:Cause: buildToolsVersion is not specified. Android studio 声明我的插件应该在模块而不是项目级别声明。

我已经在“build.grade (Module:app)”文件中设置了 buildTools。我的问题是为什么会发生这种情况,我该如何补救?我在下面发布了我的代码。提前致谢。 - 阿德里安

build.grade(项目:NumenuApp)

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

buildscript {
    repositories {
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

allprojects {
    repositories {
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
    }
}

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

build.grade(模块:应用程序)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "com.numenu.numenuapp"
    minSdkVersion 21
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.android.support:support-v4:23.1.1'
    compile 'com.android.support:recyclerview-v7:23.1.1'
}

最佳答案

您必须从 build.gradle (Project:NumenuApp) 中删除这些行。您正在使用错误的文件来应用插件。

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

同时将这些行移动到您的 build.gradle (Module:app)

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

关于android - 错误 :Cause: buildToolsVersion is not specified in build. 等级(项目:xxx),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35030027/

相关文章:

java - 什么是 "default location"用于 Struts 操作(在配置浏览器中)?

java - 带有 MemoryMappedFile 和中断文件的 Log4j2

java - 通过独立的java代码访问android的内存

android - 翻译动画帮助不大

java - Libgdx:即使在成功构建后,库也不会显示在自动完成中?

android - 连线内存不足 : Java heap space error with ffmpeg library

java - 创建套接字导致强制关闭

android - Sinch无法在后台运行(Android)

java - 在运行 gradle eclipse 任务之前是否需要关闭 Eclipse?

.net - 每个 AppDomain 允许有多少个 app.config 文件?