I am stuck at getting this project to work, any pointers would be very helpful. I am getting these error messages from screenshot below and can't figure out what it means.

Some posts I found suggest it is kotlin or gradle versions that are issue but tried few of those solutions and it didn't work. I don't think this is it as it was working and then when I had to restart I got these errors once again. I think it's some issue around emulator.

I tried flutter clean / flutter pub get but it doesn't solve it.

Project is in android studio with flutter/dart.

I tried removing emulator and creating new one, also closed and opened app..nothing worked.

Do error messages reveal anything obvious to anyone?

Error messages:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.15.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.1.15/kotlin-gradle-plugin-1.1.15.pom
       - https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.1.15/kotlin-gradle-plugin-1.1.15.pom
     Required by:
         project :

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
Exception: Gradle task assembleDebug failed with exit code 1

Screen shot of error messages.

Edit Adding build.gradle below:

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

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

android {
    compileSdkVersion 31

    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.example.rapid_reps" +
                ""
        minSdkVersion 21
        targetSdkVersion 30
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    buildTypes {
        release {

            signingConfig signingConfigs.debug
        }
    }
}

    flutter {
        source '../..'
    }

    dependencies {
        implementation platform('com.google.firebase:firebase-

    bom:29.0.0')
            implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    }

Edit 2 It works like suggested by changing kotlin version directly in code, here are the warnings in case this is connected:

Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: C:\flutter\flutter.pub-cache\hosted\pub.dartlang.org\cloud_firestore-3.1.0\android\src\main\java\io\flutter\plugins\firebase\firestore\streamhandler\TransactionStreamHandler.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details.


Solution 1: Haider Saleem

You need to update your kotlin gradle plugin version to any latest in gradle (project), you can probably use 1.5.10. The version you have used is 1.1.15, and its not a valid version.

After 1.1.1, version 1.1.2 came out.

For more info, you can check here