android - Gradle 错误使用 fbutton

标签 android gradle configuration

我的 gradle 配置有问题。在我的应用程序中,我使用 FButton,当我使用它时,我的版本 gradle 有问题,所以我将版本 3.0.1 更改为 2.3.3,但是现在当我重建我的 gradle 时出现此错误:错误:原因:未指定 buildToolsVersion。

build.gradle (项目)

buildscript {

repositories {
    google()
    jcenter()
    mavenCentral()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.3.3'
    classpath 'com.google.gms:google-services:3.1.0'
}
allprojects {
repositories {
    google()
    jcenter()
}
}

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

build.gradle(模块)
apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.dell.eatapp"
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:26.1.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    androidTestCompile ('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    compile 'com.google.firebase:firebase-core:10.2.0'
    compile 'com.google.firebase:firebase-database:10.2.0'
    compile 'info.hoang8f:fbutton:1.0.5'
    compile 'com.rengwuxian.materialedittext:library:2.1.4'
}

apply plugin: 'com.google.gms.google-services'

最佳答案

解决方案相当简单,通过降级 gradle 版本,您更改了 build.gradle 的需求脚本。

只需将这个版本所需的 buildToolsVersion 添加到您的模块 build.gradle

android {
    buildToolsVersion = "26.0.2"

    //... other android configs
}

您可以阅读有关更改 here这是针对 3.X.X 版本的 android gradle 插件。

文章中的重要标注:

You no longer need to specify a version for the build tools (so, you can now remove the android.buildToolsVersion property). By default, the plugin automatically uses the minimum required build tools version for the version of Android plugin you're using.



总而言之,既然您降级到 3.0.0 以下,您现在需要重新添加 buildToolsVersion到 gradle 脚本。

祝你好运,编码愉快!

关于android - Gradle 错误使用 fbutton,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48722581/

相关文章:

带有自定义布局的 Android 对话框将组件压缩在一起

android - Android 文档数据库?

android - value/arrays.xml 中的帧动画

android - 将 flutter 从 2.5 升级到 2.8 后出错

mysql - 如何在不更改配置文件的情况下将 mysql character_set_database 设置为 utf8mb4?(因为我无权访问这些文件)

Android 设备 onConfigurationChanged 事件不处理方向

android - 使用 Intent 将图像设置为墙纸

gradle - 如何在 Gradle 中签署 jar 文件

android-studio - 在构建阶段找不到房间编译器错误

c# - 使VS2010项目文件提示路径默认为绝对路径?