簡體   English   中英

添加 Firebase 的 Classpath 依賴項時出現問題

[英]Problem Occurred while adding Classpath dependencies of Firebase

添加 Firebase 的 Classpath 依賴項時出現問題

這是我的 Gradle.project 文件

plugins {
id "com.android.application" version "7.3.1" apply false
id "com.android.library" version "7.3.1" apply false
id "com.google.gms.google-services" version "4.3.14" apply false
}

dependencies {
    // Add the dependency for the Google services Gradle plugin
    classpath 'com.android.tools.build:gradle:7.3.1'
    classpath 'com.google.gms:google-services:4.3.14'
}

這是我的 Gradle 模塊文件

    plugins {
    id 'com.android.application'
}
apply plugin: 'com.google.gms.google-services'
android {
    namespace 'com.example.anonymous'
    compileSdk 32

    defaultConfig {
        applicationId "com.example.anonymous"
        minSdk 19
        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
    }
}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.4.1'
    implementation 'com.google.android.material:material:1.5.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

    implementation platform('com.google.firebase:firebase-bom:31.1.0')
    implementation 'com.google.firebase:firebase-analytics'

    implementation 'com.airbnb.android:lottie:5.2.0'
    implementation 'de.hdodenhof:circleimageview:3.1.0'
}

同步 Gradle 時出現此錯誤

在類型為 org.gradle.api.internal.artifactencyHdependencies.dsl 的 object 上找不到 arguments [com.android.tools.build.gradle:7.3.1] 的方法類路徑()

您的 build.gradle(項目)文件應如下所示:

buildscript {
    dependencies {
        classpath 'com.android.tools.build:gradle:7.3.1'
        classpath 'com.google.gms:google-services:4.3.14'
    }
}

plugins {
    id "com.android.application" version "7.3.1" apply false
    id "com.android.library" version "7.3.1" apply false
    id "com.google.gms.google-services" version "4.3.14" apply false
}

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

所有buildscript {}塊必須出現在腳本中任何plugins {}塊之前。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM