【问题标题】:Android Studio - Could not parse the Android Application Module's Gradle configAndroid Studio - 无法解析 Android 应用程序模块的 Gradle 配置
【发布时间】:2022-07-17 07:11:02
【问题描述】:

我希望使用 firebase 开发一个聊天应用。但是,我无法在助手面板中连接到 Firebase。相反,它显示此错误消息

Could not parse the Android Application Module's Gradle config. Resolve gradle build issues and/or resync.

我尝试在网上搜索修复,人们建议从 gradle 中删除 jCenter(),但我的文件中什至没有此代码。我能够同步我的项目,一切似乎都正常,只是我无法连接到它。

项目等级:

// 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"
        classpath "com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.0"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

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

模块分级

plugins {
    id 'com.android.application'
    id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
}

android {
    compileSdk 32

    defaultConfig {
        applicationId "android.exercise.myExercise"
        minSdk 21
        targetSdk 32
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

        Properties properties = new Properties()

        properties.load(project.rootProject.file('local.properties').newDataInputStream())
        manifestPlaceholders = [MAPS_API_KEY: "${properties.getProperty('secret-apiKey')}"]
    }

    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
    }
}

dependencies {
    implementation 'com.google.android.gms:play-services-maps:18.0.1'
    implementation 'androidx.appcompat:appcompat:1.4.0'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
    implementation 'androidx.navigation:navigation-fragment:2.3.5'
    implementation 'androidx.navigation:navigation-ui:2.3.5'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.annotation:annotation:1.3.0'
    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
    implementation 'com.google.android.material:material:1.6.0-alpha01'
    implementation 'com.github.VishnuSivadasVS:Advanced-HttpURLConnection:1.2'
    implementation 'com.google.android.gms:play-services-maps:18.0.2'
    testImplementation 'junit:junit:4.13'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

    // chat sys
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'com.google.firebase:firebase-auth:19.0.0'
    implementation 'com.google.firebase:firebase-database:19.1.0'
    implementation 'com.google.firebase:firebase-core:17.2.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.rengwuxian.materialedittext:library:2.1.4'

}

【问题讨论】:

  • 也许这个answer 可以提供帮助。

标签: firebase android-studio gradle


【解决方案1】:

有点晚了,但我仍然可以提供帮助。我有同样的问题。我解决了这个问题

文件>项目规范>模块 或者 Ctrl+Alt+Shift+S >模块

编译sdk版本:32或最新版本 构建工具版本:32.0.0 或最新版本

然后点击应用按钮 然后点击确定按钮

问题就解决了。

对不起我的英语,我不懂英语。

【讨论】:

    【解决方案2】:

    删除这一行

    testImplementation 'junit:junit:'

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-11-01
      • 2017-12-29
      • 1970-01-01
      • 2022-09-23
      • 1970-01-01
      • 2023-03-26
      • 1970-01-01
      相关资源
      最近更新 更多