Home > Mobile >  Do I need to update or change anything in my gradle files?
Do I need to update or change anything in my gradle files?

Time:10-14

"A problem occurred evaluating project ':app'."

I tried looking at old solutions for this error but some of the suggestions were to change versions. Is that what I should be doing? If so, what version should I change to? And is this related to my other error "Plugin with id 'com.google.gms.google-services:4.3.10' not found."?

android/build.gradle:

buildscript {
    ext.kotlin_version = '1.5.31'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.0'
        classpath 'com.google.gms:google-services:4.3.10'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
    project.evaluationDependsOn(':app')
}

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

app/build.gradle:

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services:4.3.10'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 30

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

    sourceSets {
        main.java.srcDirs  = 'src/main/kotlin'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.app.app"
        minSdkVersion 16
        targetSdkVersion 30
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        multiDexEnabled true   
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.multidex:multidex:2.0.1'
}

gradel-wrapper.properties:

distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip

[✓] Flutter (Channel stable, 2.5.2, on macOS 11.6 20G165 darwin-x64, locale en-CA)

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)

[✓] Xcode - develop for iOS and macOS

[✓] Chrome - develop for the web

[✓] Android Studio (version 2020.3)

CodePudding user response:

In the 'app/build.gradle' file, at the top you have:

apply plugin: 'com.google.gms.google-services:4.3.10'

This should not include the version.

You define the version in the project build.gradle file (the first one you posted)

It should just be:

apply plugin: 'com.google.gms.google-services'
  • Related