Android Studio 中“无法解析 Android 应用程序模块的 Gradle 配置”?错误

问题描述 投票:0回答:1

我正在使用 firebase 开发 jetpack compose android 应用程序但是当我运行项目时我得到以下异常

无法解析 Android 应用程序模块的 Gradle 配置。解决 gradle 构建问题和/或重新同步 我按照这个答案Android Studio的项目gradle文件改变了?但它没有解决我的问题

在我的 app.gradle 文件下面

 plugins {
        id 'com.android.application'
        id 'org.jetbrains.kotlin.android'
        id 'kotlin-kapt'
        id 'com.google.gms.google-services'
    }
    
    android {
        compileSdk 33
    
        defaultConfig {
            applicationId "com.example.firebasegooglesignjetpackcompose"
            minSdk 24
            targetSdk 33
            versionCode 1
            versionName "1.0"
    
            testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
            vectorDrawables {
                useSupportLibrary true
            }
        }
    
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            }
        }
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
        kotlinOptions {
            jvmTarget = '1.8'
        }
        buildFeatures {
            compose true
        }
        composeOptions {
            kotlinCompilerExtensionVersion '1.4.3'
        }
        packagingOptions {
            resources {
                excludes += '/META-INF/{AL2.0,LGPL2.1}'
            }
        }
        buildToolsVersion '33.0.0'
        ndkVersion '33.0.0'
    }
    
    dependencies {
    
        implementation 'androidx.core:core-ktx:1.7.0'
        implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
        implementation 'androidx.activity:activity-compose:1.3.1'
        implementation "androidx.compose.ui:ui:$compose_ui_version"
        implementation "androidx.compose.ui:ui-tooling-preview:$compose_ui_version"
        implementation 'androidx.compose.material:material:1.2.0'
        testImplementation 'junit:junit:4.13.2'
        androidTestImplementation 'androidx.test.ext:junit:1.1.5'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
        androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_ui_version"
        debugImplementation "androidx.compose.ui:ui-tooling:$compose_ui_version"
        debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_ui_version"
        implementation platform('com.google.firebase:firebase-bom:31.5.0')
    
        implementation 'com.google.firebase:firebase-auth-ktx:21.3.0'
        implementation 'com.google.android.gms:play-services-auth:20.5.0'
    
        implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.6.0"
        implementation "androidx.lifecycle:lifecycle-runtime-compose:2.6.0"
        implementation "androidx.navigation:navigation-compose:2.5.3"
        implementation "io.coil-kt:coil-compose:2.2.2"
    
    
    }

低于 build.gradle

buildscript {
    ext {
        compose_ui_version = '1.4.0'
    }
    dependencies {
        classpath 'com.google.gms:google-services:4.3.15'
    }

}// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    id 'com.android.application' version '7.2.1' apply false
    id 'com.android.library' version '7.2.1' apply false
    id 'org.jetbrains.kotlin.android' version '1.8.10' apply false
    id 'com.google.gms.google-services' version '4.3.15' apply false
}
task clean(type: Delete) {
    delete rootProject.buildDir
}

我想知道我在哪里犯了错误我正在使用android studio bumble版本

android android-studio firebase-authentication android-jetpack-compose
1个回答
0
投票

我通过将 android studio 版本从 bumbble 版本更新到 flamingo 来解决问题

© www.soinside.com 2019 - 2024. All rights reserved.