简体   繁体   English

无法解析 Android 应用模块的 Gradle 配置,连接到 Firebase 时

[英]Could not parse the Android Application Module's Gradle config ,While connecting to Firebase

I am getting this error,While connecting the app to firebase from the firebase assistant in Android Studio.我收到此错误,同时从 Android Studio 中的 firebase 助手将应用程序连接到 firebase。 Error message - Could not parse the Android Application Module's Gradle config.错误消息 -无法解析 Android 应用模块的 Gradle 配置。 Resolve gradle build issues and/or resync.解决 gradle 构建问题和/或重新同步。 I tried every posted Solution from Stack overflow and had watched many you tube videos, even cleared the gradle caches and also Updated the IDE.我尝试了 Stack overflow 中发布的所有解决方案,并观看了许多你的视频,甚至清除了 gradle 缓存并更新了 IDE。 Even There is No error or Warning in my Gradle build files.即使我的 Gradle 构建文件中没有错误或警告。

>build.gradle(app) >build.gradle(应用程序)

plugins {
    id 'com.android.application'
    id 'com.google.gms.google-services'
}

android {
    compileSdk 32

    defaultConfig {
        applicationId "com.project.PlacementInfo"
        minSdk 25
        targetSdk 32
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildFeatures {
        dataBinding = 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
    }
    compileSdkVersion 32
    buildToolsVersion '32.0.0'
}

dependencies {

    implementation 'com.google.android.gms:play-services-location:20.0.0'
    implementation 'com.google.firebase:firebase-analytics'
    implementation platform('com.google.firebase:firebase-bom:30.2.0')
    implementation 'androidx.appcompat:appcompat:1.4.2'
    implementation 'com.google.android.material:material:1.6.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation 'com.google.firebase:firebase-database:20.0.5'
    testImplementation 'junit:junit:'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

}

>build.gradle(Project) >build.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"
        classpath "com.android.tools.build:gradle:4.2.2"
        classpath 'com.google.gms:google-services:4.3.13'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

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

well here you have to add classpath in gradle level 1那么在这里你必须在 gradle 级别 1 中添加类路径

 // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { google() jcenter() } dependencies { classpath "com.android.tools.build:gradle:4.1.2" classpath 'com.google.gms:google-services:4.3.10' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { google() jcenter() maven { url "https://github.com/jitsi/jitsi-maven-repository/raw/master/releases" } } } task clean(type: Delete) { delete rootProject.buildDir }

then you have to add apply plugin in gradle level 2那么你必须在 gradle 级别 2 中添加应用插件

below dependencies以下依赖项

 plugins { id 'com.android.application' } android { compileSdkVersion 31 defaultConfig { applicationId "com.example.chatapp" minSdkVersion 23 targetSdkVersion 31 versionCode 1 versionName "1.0" multiDexEnabled true 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 } } dependencies { implementation 'androidx.appcompat:appcompat:1.4.1' implementation 'com.google.android.material:material:1.5.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.3' implementation platform('com.google.firebase:firebase-bom:29.2.1') implementation 'com.google.firebase:firebase-analytics' implementation 'com.google.firebase:firebase-auth:21.0.1' implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1' implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1' implementation 'com.android.support:multidex:1.0.3' implementation 'com.google.firebase:firebase-firestore:24.1.0' implementation 'com.google.firebase:firebase-storage:20.0.1' implementation 'com.squareup.picasso:picasso:2.71828' implementation 'com.firebaseui:firebase-ui-firestore:6.2.1' implementation 'com.firebaseui:firebase-ui-database:8.0.0' implementation 'com.google.firebase:firebase-database:20.0.4' implementation 'com.google.firebase:firebase-messaging:23.0.5' implementation ('org.jitsi.react:jitsi-meet-sdk:3.10.2') { transitive = true } implementation 'com.android.volley:volley:1.2.0' implementation 'com.google.firebase:firebase-appcheck-safetynet:16.0.0' testImplementation 'junit:junit:4.+' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' } apply plugin: 'com.google.gms.google-services'

source [here]来源[这里]

Issue is resolved, removed this line testImplementation 'junit:junit:' from build.gradle (app) and also compressed the compile SDK from 32 to 31 and added this line android.suppressUnsupportedCompileSdk=32 in the gradle's properties(Project) Issue is resolved, removed this line testImplementation 'junit:junit:' from build.gradle (app) and also compressed the compile SDK from 32 to 31 and added this line android.suppressUnsupportedCompileSdk=32 in the gradle's properties(Project)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法解析 Android 应用模块的 Gradle 配置 - Could not parse the Android Application Module's Gradle config 错误:无法解析 Android 应用程序模块的 Gradle 配置。 解析或重新同步(构建 gradle 应用程序中没有存储库) - Error: Could not parse the Android application Module's Gradle Config. Resolve or resync (no repositories in build gradle app) Android Studio 构建错误:Gradle - 找不到平台('com.google.firebase:firebase-bom:30.3.1') - Android Studio build error: Gradle - Could not find platform('com.google.firebase:firebase-bom:30.3.1') 将 laravel 与 firebase 连接时出错 - Getting error while connecting laravel with firebase 您试图通过调用 firebase.storage() 来使用未安装在 android 项目上的 firebase 模块 - You attempted to use a firebase module that's not installed on your android project by calling firebase.storage() “您试图通过调用 firebase.app() 来使用 Android 项目中未安装的 firebase 模块。” - "You attempted to use a firebase module that's not installed on your Android project by calling firebase.app()." 如何知道远程配置在 android firebase 中工作 - How to know remote config working in android firebase Android Studio的项目gradle文件改了? - Android Studio's project gradle file changed? Expo Firebase 身份验证“尝试从文件中解析模块 `idb` 时” - Expo Firebase Authentication "While trying to resolve module `idb` from file" Firebase 模块在部署功能时需要旧版本的节点 - Firebase module requires an older version of node while deploying the functions
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM