我的 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/