【发布时间】:2022-07-17 07:07:04
【问题描述】:
我正在尝试在我的 android 项目中设置 Firebase。我收到此错误:enter image description here
无法解析 Android 应用程序模块的 Gradle 配置。解决 gradle 构建问题和/或重新同步。
一直在网上寻找修复,其中大多数正在删除 build.gradle 文件中的 jcenter()。我在我的 build.gradle 中没有 jcenter() 或任何其他存储库。
我尝试按照 Firebase 的手册进行操作,但事情变得更加混乱。 我的 android studio 版本可能有问题吗? 我正在使用 Android Studio 北极狐 | 2020.3.1 补丁 4。 Android gradle 插件版本:7.0.4 Gradle 版本:7.0.2
这是我的构建 gradle 项目:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
构建 gradle 模块(应用):
plugins {
id 'com.android.application'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.example.autentikacija"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding true
}
compileSdkVersion 32
buildToolsVersion '30.0.2'
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
implementation 'com.google.android.gms:play-services-maps:18.0.1'
testImplementation 'junit:junit:'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
任何帮助表示赞赏。
【问题讨论】:
-
解决办法是什么?
标签: android firebase authentication firebase-authentication build.gradle