I am Developing flutter mobile app, I have done with the necessary setup for releasing, following flutter documentation (https://docs.flutter.dev/deployment/android), when ever am trying to run flutter build appbundle I do get this error
FAILURE: Build failed with an exception.
* What went wrong:
Unexpected lock protocol found in lock file. Expected 3, found 0.
* 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
Please can resolve this error
Related
whenever i run my app it gives me this error FAILURE: Build failed with an exception.
What went wrong:
Could not update C:\Users\abdou.gradle\caches\7.4\file-changes\last-build.bin
C:\Users\abdou.gradle\caches\7.4\file-changes\last-build.bin (Access is denied)
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 14s
Exception: Gradle task assembleDebug failed with exit code 1
. My app was working the day before just fine.
I tried to create a new flutter project and move all my files there and rerun the project it didn't work .
I am new to flutter and watned to create my first app.
I installed Flutter. I tested it using flutter doctor and got no errors. I created a new app using flutter create my_app. In the app directory I ran flutter build apk and got the following error back.
C:\Users\Username\StudioProjects\my_app3> flutter build apk
Building with sound null safety
FAILURE: Build failed with an exception.
* What went wrong:
Could not create an instance of type org.gradle.invocation.DefaultGradle.
> Could not configure services using GradleScopeCompileServices.configure().
* 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
Running Gradle task 'assembleRelease'... 2.560ms
Gradle task assembleRelease failed with exit code 1
I created a new app.
Added audioplayers flutter package from https://pub.dev/packages/audioplayers.
Shows an error from Android Embedding. I followed the instructions https://flutter.dev/go/android-project-migration.
Now I get this error:
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Build file 'C:\src\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\build.gradle' line: 23
* What went wrong:
A problem occurred evaluating project ':audioplayers'.
> Plugin with id 'kotlin-android' not found.
* 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.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':audioplayers'.
> compileSdkVersion is not specified.
* 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 3s
Exception: Gradle task assembleDebug failed with exit code 1
Then I followed https://github.com/react-native-webview/react-native-webview/issues/1407 thread to do what suggested.
Now I'm getting this error:
FAILURE: Build failed with an exception.
Where:
Build file 'C:\src\flutter\flutter.pub-cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\build.gradle' line: 49
What went wrong:
A problem occurred evaluating project ':audioplayers'.
Could not get unknown property 'kotlin_version' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
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'm very new in android studio development, it drives me crazy with these configurations. Thank you very much.
For those who came up with the same problem I have. The project I'm working came from Git and I think that project wasn't updated for Android Embedding v2 so I got the first error.
Now in the second error, all I did was to read other's bug fixes (not officially).
Adding the dependencies and kotlin-version (1.4.20) needed for the main package(audioplayers). C:\flutter\flutter.pub-cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\
Making the android project's app build.gradle>defaultConfig>minSdkVersion to 23 (from 16)
Use pub get and update in pubspec.yaml.
I am developing flutter with VS Code and while compiling I get the following error
FAILURE: Build failed with an exception.
* What went wrong:
Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
Could not create service of type FileHasher using BuildSessionScopeServices.createFileSnapshotter().
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.
then I ran the project with Android Studio but I get a similar error.
What other solution could there be other than starting a new project?
FAILURE: Build failed with an exception. * What went wrong: Could not initialize class org.codehaus.groovy.runtime.InvokerHelper * 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 ok sir
this is due to incompatible gradle version so first go to
folder : android\gradle\wrapper
open he file gradle-wrapper.properties
and change
distributionUrl=https://services.gradle.org/distributions/gradle-6.2-all.zip
to
distributionUrl=https://services.gradle.org/distributions/gradle-6.7-all.zip
simply we have to change the latest version