why i have error in gardel task running in flutter - flutter

I Want runn my flutter project on android Emulator but I have Gardel task Error.
this is my Error:
Execution failed for task ':app:checkDebugAarMetadata'.
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not resolve io.flutter:arm64_v8a_debug:1.0.0-f93dc3d7860f9a47b3367809b37ca7bb90c9817a.
Required by:
project :app
0
0
29
Debug my code
M2007J20CG (android-arm64)
Flutter: 2.11.0-0.0.pre.695
Dart DevTools
Dart
CRLF
UTF-8
Spaces: 2
Ln 65, Col 58
Info: Running Gradle task 'assembleDebug'...
i'm searching alot but i dont underestand

Related

Could not determine the dependencies of task ‘:app:compileDebugJavaWithJavac’ flutter

Launching lib\main.dart on Android SDK built for x86 in debug mode...
FAILURE: Build failed with an exception.
What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
Could not resolve io.grpc:grpc-core:[1.21.0].
Required by:
project :app > io.grpc:grpc-okhttp:1.21.0
> Failed to list versions for io.grpc:grpc-core.
> Unable to load Maven meta-data from https://jcenter.bintray.com/io/grpc/grpc-core/maven-metadata.xml.
> Could not HEAD 'https://jcenter.bintray.com/io/grpc/grpc-core/maven-metadata.xml'.
> org.apache.http.client.ClientProtocolException (no error message)
> Failed to list versions for io.grpc:grpc-core.
> Unable to load Maven meta-data from https://jcenter.bintray.com/io/grpc/grpc-core/maven-metadata.xml.
> Could not HEAD 'https://jcenter.bintray.com/io/grpc/grpc-core/maven-metadata.xml'.
> org.apache.http.client.ClientProtocolException (no error message)
> Failed to list versions for io.grpc:grpc-core.
> Unable to load Maven meta-data from https://jcenter.bintray.com/io/grpc/grpc-core/maven-metadata.xml.
> Could not HEAD 'https://jcenter.bintray.com/io/grpc/grpc-core/maven-metadata.xml'.
Get more help at https://help.gradle.org
BUILD FAILED in 15s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

Exception: Gradle task assembleDebug failed with exit code 1 flutter project

I am running one of my old flutter project in the latest version of android studios and I am facing the issue while running the project please can you help me with this.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
Multiple task action failures occurred:
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
The minCompileSdk (31) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-30).
Dependency: androidx.window:window-java:1.0.0-beta04.
AAR metadata file: C:\Users\disha.gradle\caches\transforms-2\files-2.1\625039eaad011f884ddd84f857a44b7f\jetified-window-java-1.0.0-beta04\META-
INF\com\android\build\gradle\aar-metadata.properties.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
The minCompileSdk (31) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-30).
Dependency: androidx.window:window:1.0.0-beta04.
AAR metadata file: C:\Users\User_Name.gradle\caches\transforms-2\files-2.1\a78fdf90e4c1f8464b19895cfb365f3f\jetified-window-1.0.0-beta04\META-INF\c
om\android\build\gradle\aar-metadata.properties.
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 8s
Running Gradle task 'assembleDebug'... 9.5s
Exception: Gradle task assembleDebug failed with exit code 1
Solution of the error
the error is kind of obvious , As the log says
"The minCompileSdk (31) is greater than this module's
compileSdkVersion (android-30)"
which means you are trying to run a project with a minimum android api version of 31 on the emulator or device with the android api version of 30 .
Solution 1 : Reduce the SDK version for the project (Which is not recommended because you have increased it for a reason )
Solution 2 : Change the emulator or the device for debug .
For more guides on android api version : check here
But you might run into more gradle failures , AS ALWAYS , hope not but if you did please make a new issue .
What you need to do is to update your build.gradle file in android/app folder.
Set the following to this values:
compileSdkVersion 31
minSdkVersion 19 or (Lower if you want to cater older versions)
targetSdkVersion 31

VScode BUILD FAILED Exception: Gradle task assembleDebug failed with exit code 1

I am trying to code an app for the first time with flutter in vs code and I am getting this error,
FAILURE: Build failed with an exception.
Where:
Build file 'C:\Users\ajgoc\Desktop\Badges\badges_gram\buddies_gram-master\android\build.gradle' line: 29
What went wrong:
A problem occurred evaluating root project 'android'.
A problem occurred configuring project ':app'.
Failed to notify project evaluation listener.
> 'org.gradle.api.file.DirectoryProperty org.gradle.api.file.ProjectLayout.directoryProperty(org.gradle.api.provider.Provider)'
Exception: Gradle task assembly debug failed with exit code 1
I have tried a couple of things to fix it but haven't gotten anything to work. The app will still load in the emulator but it is an older version of the app. Here is what my gradle-wrapper.poperties and build.gradle files look like.
gradle-wrapper.poperties
build.gradle
flutter doctor -v output

Flutter build error - Android resource linking failed. even set compileSdkVersion 28

Please help, I'm facing problem when building realease apk file as below. I have tried searching but found only to set compileSdkVersion 28 in build.gradle file, but unlucky for my case. Any body has suggestion?
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':flutter_appavailability:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> 1 exception was raised by workers:
com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
/Users/adsavin/.gradle/caches/transforms-2/files-2.1/855694052351881cfd5b05bbd4ccb2f3/core-1.0.1/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/fontVariationSettings not found.
/Users/adsavin/.gradle/caches/transforms-2/files-2.1/855694052351881cfd5b05bbd4ccb2f3/core-1.0.1/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/ttcIndex 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.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 58s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 122.4s (!)
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the
incompatibility.
Building plugin connectivity...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done 4.6s
✓ Built build/app/outputs/repo.
Building plugin connectivity_macos...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done 5.3s
✓ Built build/app/outputs/repo.
Building plugin firebase_auth...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done 4.8s
✓ Built build/app/outputs/repo.
Building plugin firebase_auth_web...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done 4.5s
✓ Built build/app/outputs/repo.
Building plugin firebase_core...
The plugin firebase_core could not be built due to the issue above.
Running Gradle task 'assembleAarRelease'... ```
Please migrate your app in android x and if it's already done then please
check your plugin version compatible with android x
https://flutter.dev/docs/development/androidx-migration

Running Gradle task 'assembleDebug'... [Fatal Error] aapt2-3.5.0-5435860.pom:2:1: Content is not allowed in prolog

No errors when flutter doctor command was executed. I tried with updating Gradle with the latest version 6.4 and setting at env variable path as well, in the dist folder as well it is showing correctly.
gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
android/app/build.gradle
- compileSdkVersion 28
- targetSdkVersion 28
android/build.gradle
google() is added to allprojects and buildscript.repositories
I tried all approaches mentioned in similar kind of queries in StackOverflow and other platforms but of no use, I am totally stuck here.
how to resolve this error?
On flutter run command following ERROR is what I get:
Running Gradle task 'assembleDebug'...
[Fatal Error] aapt2-3.5.0-5435860.pom:2:1: Content is not allowed in prolog.**
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Could not resolve all files for configuration ':app:_internal_aapt2_binary'.
> Could not resolve com.android.tools.build:aapt2:3.5.0-5435860.
Required by:
project :app
> Could not resolve com.android.tools.build:aapt2:3.5.0-5435860.
> Could not parse POM https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/3.5.0-5435860/aapt2-3.5.0-5435860.pom
> Content is not allowed in prolog.
* 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 6m 22s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 401.6s (!)
Exception: Gradle task assembleDebug failed with exit code 1