Saturday, 15 April 2023

Could not find method implementation() for arguments [DefaultExternalModuleDependency{group='com.google.firebase',

I made some search before posting here. I created a new project and I have the below:

From:(build gradle project)

// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    id 'com.android.application' version '7.4.2' apply false
    id 'com.android.library' version '7.4.2' apply false
}

To:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    id 'com.android.application' version '7.4.2' apply false
    id 'com.android.library' version '7.4.2' apply false
}
dependencies {
    // Import the Firebase BoM
    implementation platform('com.google.firebase:firebase-bom:31.3.0')


    // TODO: Add the dependencies for Firebase products you want to use
    // When using the BoM, don't specify versions in Firebase dependencies
    // https://firebase.google.com/docs/android/setup#available-libraries
}

So I got this error:

Could not find method implementation() for arguments [DefaultExternalModuleDependency{group='com.google.firebase', name='firebase-bom', version='31.3.0', configuration='default'}] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

this is gradle app

plugins {
    id 'com.android.application'
}

android {
    namespace 'com.example.delivery1'
    compileSdk 33

    defaultConfig {
        applicationId "com.example.delivery1"
        minSdk 25
        targetSdk 33
        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
    }
}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.8.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.1'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1'
    implementation 'androidx.navigation:navigation-fragment:2.5.3'
    implementation 'androidx.navigation:navigation-ui:2.5.3'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
    implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))
    classpath 'com.google.gms:google-services:4.3.15'
}


from Could not find method implementation() for arguments [DefaultExternalModuleDependency{group='com.google.firebase',

No comments:

Post a Comment