Could not get unknown property 'flutter' for extension 'android' of type com.android.build.gradle.internal.dsl.BaseAppModuleExtension - flutter

1. I treid uninstalling android studio and reinstalling latest version of android studio.
2. tried changing sdk version.
3.even tried changing dependy
and what not
it's been 2 days since i'm trying to solve this error. please help me to get over this
FAILURE: Build failed with an exception.
Where:
Build file 'C:\Users\91893\StudioProjects\kuk\android\app\build.gradle' line: 29
What went wrong:
A problem occurred evaluating project ':app'.
Could not get unknown property 'flutter' for extension 'android' of type com.android.build.gradle.internal.dsl.BaseAppModuleExtension.
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

Related

I have added the modal progress_ud and it asked me to update the compile sdk version to 32 when i updated the version it shows me the following error

FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring project ':modal_progress_hud_nsn'.
Could not load compiled classes for build file 'C:\flutter.pub-cache\hosted\pub.dartlang.org\modal_progress_hud_nsn-0.3.0\android\build.gradle' from cache.
Failed to notify project evaluation listener.
Could not get unknown property 'android' for project ':modal_progress_hud_nsn' of type org.gradle.api.Project.
Could not get unknown property 'android' for project ':modal_progress_hud_nsn' of type org.gradle.api.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 29s
Exception: Gradle task assembleDebug failed with exit code 1
I have updated the compile sdk version and having this error

flutter build in error does not run in android

FAILURE: Build failed with an exception.
Where:
Build file 'C:\Users\sajid\Desktop\amazon_clonee\android\app\build.gradle' line: 25
What went wrong:
A problem occurred evaluating project ':app'.
Could not get unknown property 'plugin' for project ':app' of type org.gradle.api.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 2s
Exception: Gradle task assembleDebug failed with exit code 1
Any one solve this error

Could not get unknown property 'applicationVariants' for extension 'android' of type com.android.build.gradle

I Create a flutter project ,change it to library and then build aar with command "gradle aR",but the following error occurred。(flutter SDK 1.22.4 can do this without error,other version can not)
FAILURE: Build failed with an exception.
* Where:
Script 'flutter/packages/flutter_tools/gradle/flutter.gradle' line: 978
* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
> Could not get unknown property 'applicationVariants' for extension 'android' of type com.android.build.gradle.LibraryExtension.
* 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 3m 57s

Could not get unknown property 'ndkVersion' for extension 'flutter' of type FlutterExtension

Issue after flutter upgrade Updated ndk but not working working fine for flutter web but on andorid showing
FAILURE: Build failed with an exception.
Where:
Build file 'D:\flutter practice\Instagramclone\android\app\build.gradle' line: 31
What went wrong:
A problem occurred evaluating project ':app'.
Could not get unknown property 'ndkVersion' for extension 'flutter' of type FlutterExtension.
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 13s
Exception: Gradle task assembleDebug failed with exit code 1
For now, writing like this works fine.
android/app/build.gradle ndkVersion "23.1.7779620"
https://developer.android.com/ndk/downloads

Gradle error while running flutter app in Android Studio

Anytime I try to run the default flutter app in android studio, I get an error saying this
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\NAME\StudioProjects\first_app\android\build.gradle' line: 24
* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
> Could not open proj generic class cache for build file 'C:\Users\Jonat\StudioProjects\first_app\android\app\build.gradle' (C:\Users\Jonat\.gradle\caches\6.7\scripts\9jolsr12r2iru3ssdih8as3s3).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 60
* 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
I tried searching for an answer but I did not find a solution. I decided to open my command prompt and type in Gradle and this is what I see,
I don't know what to do or where to start since I am new to android studio. Is there a way to get rid of this error?
UPDATE
I went to the folder that was mentioned in the first error and all I needed to do was update the Gradle and it loaded everything. But now I'm receiving a new error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module #77e838c
* 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.
would anyone know how to go about this error?