I have been for the error for an hour and tried multiple gradle packages to rectify this error.But, I don't know what to do .
I have updated my flutter stable.Done all that.But none is working and coming back to where i have started.
Error
FAILURE: Build failed with an exception.
* Where:
Build file 'D:\Github\block_porn\android\app\build.gradle.kts' line: 1
* What went wrong:
An exception occurred applying plugin request [id: 'dev.flutter.flutter-gradle-plugin']
> Failed to apply plugin 'dev.flutter.flutter-gradle-plugin'.
> class com.android.build.gradle.internal.dsl.ApplicationExtensionImpl$AgpDecorated_Decorated cannot be cast to class com.android.build.gradle.AbstractAppExtension (com.android.build.gradle.internal.dsl.ApplicationExtensionImpl$AgpDecorated_Decorated and com.android.build.gradle.AbstractAppExtension are in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader$InstrumentingVisitableURLClassLoader @708305b2)
* 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 from a Build Scan (powered by Develocity).
> Get more help at https://help.gradle.org.
BUILD FAILED in 1s
4 actionable tasks: 4 up-to-date
JAVA VERSION : java 17.0.11 2024-04-16 LTS
gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.1-bin.zip
android/app/build.gradle.kts
plugins {
id("com.android.application")
id("com.google.gms.google-services")
id("dev.flutter.flutter-gradle-plugin")
id("org.gradle.toolchains.foojay-resolver-convention")
}
android {
namespace = "com.example.block_porn"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
defaultConfig {
applicationId = "com.example.block_porn"
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
}
buildTypes {
release {
signingConfig = signingConfigs.getByName("debug")
}
}
}
kotlin {
compilerOptions {
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
}
}
flutter {
source = "../.."
}
gradle.properties
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android/settings.gradle.kts
pluginManagement {
val flutterSdkPath =
run {
val properties = java.util.Properties()
file("local.properties").inputStream().use { properties.load(it) }
val flutterSdkPath = properties.getProperty("flutter.sdk")
require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
flutterSdkPath
}
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id ("dev.flutter.flutter-plugin-loader") version "1.0.2"
id("com.android.application") version "8.2.2" apply false
id("org.jetbrains.kotlin.android") version "1.9.20" apply false
id("com.android.library") version "9.3.0" apply false
id("com.google.gms.google-services") version("4.4.4") apply false
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
}
include(":app")
I will be glad with knowing the proper compactability version.Every time it is like a mess when i takedown this and it is taking a lot of time.