My Project runs fine then suddenly after i edit some image and run it, it gets error.
Here is the error I get when running flutter on my mobile phone emulator
You are applying Flutter's app_plugin_loader Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate to applying Gradle plugins with the declarative plugins block: https://flutter.dev/go/flutter-gradle-plugin-apply
You are applying Flutter's main Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate to applying Gradle plugins with the declarative plugins block: https://flutter.dev/go/flutter-gradle-plugin-apply
FAILURE: Build failed with an exception.
* Where:
Build file 'C:UsersfahadAndroidStudioProjectsusersandroidbuild.gradle' line: 27
* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
> Failed to notify project evaluation listener.
> 'com.android.build.api.variant.SourceDirectories$Flat com.android.build.api.variant.Sources.getByName(java.lang.String)'
* 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.
I seem to keep running into other issues related to this being caused by the gradle version or maybe google services version. I’ve tried several different versions. Currently using
classpath ‘com.android.tools.build:gradle:7.2.0’
classpath ‘com.google.gms:google-services:4.1.1’
Build.gradle
buildscript {
ext.kotlin_version = '1.9.21'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.google.gms:google-services:4.4.1'
classpath 'com.android.tools.build:gradle:7.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
}```
i tried to change the version of my gradle file but doesn't work and also i try to flutter clean and run.
fahader kick is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.