【发布时间】:2021-07-31 14:42:03
【问题描述】:
我尝试将项目设置中的构建工具版本设置为 25.0.0。并且还要添加正确的应用插件语句(您会在屏幕截图中找到它)。我也尝试过将项目与 Gradle 文件同步,尽管我认为这个问题与此无关。
基本上确保它在那里。我还下载并更新了所需的 SDK。我会附上截图。
build.gradle 文件截图 https://i.stack.imgur.com/ardbH.png
项目结构设置 > 模块 https://i.stack.imgur.com/jRR09.png
SDK 信息 https://i.stack.imgur.com/1n4jr.png
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:2.2.2'
classpath 'com.google.gms:google-services:3.0.0'
// 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
}
依赖关系
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.google.firebase:firebase-database:9.0.2'
compile "com.google.firebase:firebase-auth:9.0.2"
compile 'com.firebase:firebase-client-android:2.3.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
【问题讨论】:
-
您能否将
build.gradle附加到project级别。另外,请附上app级别build.gradle中的依赖项 -
附上他们两个请检查 Mohit Ajwani
-
请更新您的 gradle 插件。
com.android.tools.build:gradle:2.2.2在项目级文件中。这是一个旧的,也许构建工具 25.0.0 不支持它。需要查看发行说明。我很确定最新版本超过 3.4.0。 -
好的,非常感谢!
-
问题解决了吗?如果是,我可以写一个答案,然后你可以接受。
标签: android android-studio gradle android-gradle-plugin android-build