Flutter - audio_session - Could not load compiled classes for build file build.gradle from cache - flutter

I am trying to run my flutter project but facing this issue.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':audio_session'.
> Could not load compiled classes for build file 'C:\flutter_2.5.2\.pub-cache\hosted\pub.dartlang.org\audio_session-0.1.6+1\android\build.gradle' from cache.
* 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 have tried deleting audio_session-0.1.6+1 from the path C:\flutter_2.5.2\.pub-cache\hosted\pub.dartlang.org\ but it didn't work. It is creating the package folder again and again when I build the APK.

Related

I deleted some of my files in my C-drive after that my flutter project is not running and showing this exception

FAILURE: Build failed with an exception.
Where:
Settings file 'C:\Users\hassa\development\GIFT-Transport-Management-System\gtms\android\settings.gradle' line: 11
What went wrong:
A problem occurred evaluating settings 'android'.
Failed to deserialize script metadata extracted for script 'C:\flutter\flutter\packages\flutter_tools\gradle\app_plugin_loader.gradle'
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 4s
Exception: Gradle task assembleDebug failed with exit code 1
I tried to delete some of the files.

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?

Could not resolve all task dependencies for configuration ':google_sign_in:debugCompileClasspath'

App was working completely fine but suddenly it is invoking the following issue.
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':google_sign_in:compileDebugAidl'.
> Could not resolve all task dependencies for configuration ':google_sign_in:debugCompileClasspath'.
> Could not resolve project :google_sign_in_web.
Required by:
project :google_sign_in
> Unable to find a matching configuration of project :google_sign_in_web:
- None of the consumable configurations have attributes.
* 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
Finished with error: Gradle task assembleDebug failed with exit code 1
I have imported the latest google_sign_in package in pubspec.yaml but still facing the same build failed error. Any help please!
Solved it by running following command in flutter terminal:
flutter pub cache repair
All of the packages were downloaded and re-installed again.

Flutter build error: A problem occurred configuring root project 'bidirectional_scroll_view'

I am trying to build my project to APK file, but I am stuck with this error:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'bidirectional_scroll_view'.
> Failed to notify project evaluation listener.
> org.gradle.api.tasks.compile.CompileOptions.setBootClasspath(Ljava/lang/String;)V
* 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 910ms
The plugin bidirectional_scroll_view could not be built due to the issue above.
The command I had run is this: flutter build apk --split-per-abi.
If someone would help me I would be glad! :D
I was just using an old version of bidirectional_scroll_view package.

Could not determine the dependencies of task ':google_maps_flutter:compileDebugAidl'

FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':google_maps_flutter:compileDebugAidl'.
> Could not resolve all task dependencies for configuration ':google_maps_flutter:debugCompileClasspath'.
> Could not find com.google.android.gms:play-services-screens.maps:17.0.0.
Required by:
project :google_maps_flutter
* 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 1m 24s
Finished with error: Gradle task assembleDebug failed with exit code 1
I am getting this error, I changed flutter channel, run flutter clean, remove ^ before package version but didn't work.
google_maps_flutter: ^0.5.21+15
How to fix?
It fixed after deleting ~/.pub-cache