Fresh Flutter App Error: app:checkDebugAarMetadata - android

So, I'm using the command line and VScode. I'm just trying to get Flutter to run so I can try it out again, but I keep running into this error. I used it before a few months ago and now I'm trying to start a new app. Any ideas?
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\Iverson\.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\Iverson\.gradle\caches\transforms-2\files-2.1\a78fdf90e4c1f8464b19895cfb365f3f\jetified-window-1.0.0-beta04\META-INF\com\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 4s
Running Gradle task 'assembleDebug'... 5.2s
Exception: Gradle task assembleDebug failed with exit code 1

Hmm, I just reinstalled Java and it started working. Specifically, I made sure Java 8 was working.

You should set minSdkVersion on build.grade by lower number, like this
minSdkVersion 21

Related

Android build failed using eas build after upgrade SDK

Git Issue: https://github.com/expo/eas-cli/issues/1137
I upgraded my expo project to expo 44.0.0 from expo 41.0.0. While building the project using the command eas build --profile development --platform android , it fails with the above errors. Building with expo expo build:android -t apk --release-channel dev works fine.
Error output
Task :app:checkDebugAarMetadata FAILED
[stderr] FAILURE: Build failed with an exception.
[stderr] * What went wrong:
[stderr] Execution failed for task ':app:checkDebugAarMetadata'.
[stderr] > Multiple task action failures occurred:
[stderr] > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
[stderr] > The minCompileSdk (31) specified in a
[stderr] dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
[stderr] is greater than this module's compileSdkVersion (android-30).
[stderr] Dependency: androidx.camera:camera-view:1.1.0-beta02.
[stderr] AAR metadata file: /home/expo/.gradle/caches/transforms-3/12d1024712f31229ca58ab0bd8d21333/transformed/jetified-camera-view-1.1.0-beta02/META-INF/com/android/build/gradle/aar-metadata.properties.
[stderr] > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
[stderr] > The minCompileSdk (31) specified in a
[stderr] dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
[stderr] is greater than this module's compileSdkVersion (android-30).
[stderr] Dependency: androidx.camera:camera-extensions:1.1.0-beta02.
[stderr] AAR metadata file: /home/expo/.gradle/caches/transforms-3/b2e353b2c9ab37ded94a57d84d9c945e/transformed/jetified-camera-extensions-1.1.0-beta02/META-INF/com/android/build/gradle/aar-metadata.properties.
[stderr] > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
[stderr] > The minCompileSdk (31) specified in a
[stderr] dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
[stderr] is greater than this module's compileSdkVersion (android-30).
[stderr] Dependency: androidx.camera:camera-camera2:1.1.0-beta02.
[stderr] AAR metadata file: /home/expo/.gradle/caches/transforms-3/2675a37f413249dd4d5209666654efc4/transformed/jetified-camera-camera2-1.1.0-beta02/META-INF/com/android/build/gradle/aar-metadata.properties.
[stderr] > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
[stderr] > The minCompileSdk (31) specified in a
[stderr] dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
[stderr] is greater than this module's compileSdkVersion (android-30).
[stderr] Dependency: androidx.camera:camera-lifecycle:1.1.0-beta02.
[stderr] AAR metadata file: /home/expo/.gradle/caches/transforms-3/afe4b84723f7135b1bdead4bacd36e0e/transformed/jetified-camera-lifecycle-1.1.0-beta02/META-INF/com/android/build/gradle/aar-metadata.properties.
[stderr] > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
[stderr] > The minCompileSdk (31) specified in a
[stderr] dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
[stderr] is greater than this module's compileSdkVersion (android-30).
[stderr] Dependency: androidx.camera:camera-video:1.1.0-beta02.
[stderr] AAR metadata file: /home/expo/.gradle/caches/transforms-3/94888a47c690a5797cfc0500a21eeb39/transformed/jetified-camera-video-1.1.0-beta02/META-INF/com/android/build/gradle/aar-metadata.properties.
[stderr] > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
[stderr] > The minCompileSdk (31) specified in a
[stderr] dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
[stderr] is greater than this module's compileSdkVersion (android-30).
[stderr] Dependency: androidx.camera:camera-core:1.1.0-beta02.
[stderr] AAR metadata file: /home/expo/.gradle/caches/transforms-3/1d9440d353cb849104352a1a0b312396/transformed/jetified-camera-core-1.1.0-beta02/META-INF/com/android/build/gradle/aar-metadata.properties.
[stderr] * Try:
[stderr] 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.
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 3m 6s
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings
45 actionable tasks: 45 executed
Error: Gradle build failed with unknown error. Please see logs for the "Run gradlew" phase.
I've had this issue in one of my projects, I had to use ./gradlew build --warning-mode=all to check which deprecated features were giving me this issue, I believe I fixed it by upgrading one of the dependencies. You can also try to run cd android && ./gradlew clean to clean any cache ( sometimes this also may fix the issue)
I had this error too and it took me days before I could figure it out. I installed the latest version of java which as of now is jdk 17. Seems the support of this wasn't readily available yet since it was still new. I had to uninstall it and download java version 11 (jdk 11). I equally had issues finding somewhere to download it from without paying or registering. If you need to download this, check out azul
Edit:
Ensure to set it as your environment variable in your PC/mac. Control panel > system settings > system > advanced settings > environment variables > system variables > look for JAVA_HOME(or whatever you named yours) and change the path from your old installation folder to your new java 11 installation folder. You must exit from cmd or whatever terminal or version control you are using and restart it for it to get the new path. To check if the app has the new path, in your terminal, type echo %JAVA_HOME%. It should show you the new path of your java installation. Also check if the java version is set too by entering, java -version

My Flutter app cloned from the GitHub doesn't run and show these errors. I'm new to flutter. I changed Sdk version to 30, 31 but it didn't work

Launching lib\main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
One or more issues found when checking AAR metadata values:
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-29).
Dependency: androidx.window:window-java:1.0.0-beta04.
AAR metadata file: C:\Users\Rasula Wathsara\.gradle\caches\transforms-3\41a83d0cf61e3d2ab42ea706b65148ab\transformed\jetified-window-java-1.0.0-beta04\META-INF\com\android\build\gradle\aar-metadata.properties.
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-29).
Dependency: androidx.window:window:1.0.0-beta04.
AAR metadata file: C:\Users\Rasula Wathsara\.gradle\caches\transforms-3\bb9a53f8c4dc071c681fa071739dc70b\transformed\jetified-window-1.0.0-beta04\META-INF\com\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 12s
Exception: Gradle task assembleDebug failed with exit code 1
Detailed StackOverflow Answer
This usually happens when you're opening someone else's project after unzipping it and your current Android Studio Version is older to the version the project was compiled in.
The way to solve it is
Go to Help and about to see your android studio version
go to File>Project Structure> and set your Android Gradle Plugin version to your android studio version
Change the Gradle version to the one you usually use.
Build the project and it should run without any errors
app/src/build.gradle
defaultConfig {
applicationId "com.example"
minSdkVersion 19
targetSdkVersion 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
android/build.gradle
dependencies {
classpath 'com.android.tools.build:gradle:7.0.1'
}
You can try this.

Faild to run flutter app in Android Emulator with Android Studio

When I run flutter app in Android Emulator with Android Studio,it throws a error like 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: /Users/yh/.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: /Users/yh/.gradle/caches/transforms-2/files-2.1/a78fdf90e4c1f8464b19895cfb365f3f/jetified-window-1.0.0-beta04/META-INF/com/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 11m 11s
Exception: Gradle task assembleDebug failed with exit code 1
anyone can help me?

Android crashes when executing after installing oneSingal React-Native

In react native, after adding onesignal package I am getting this error. Can anybody help me about this issue??
Task :app:checkDebugAarMetadata FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings
25 actionable tasks: 5 executed, 20 up-to-date
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
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.work:work-runtime:2.7.1.
AAR metadata file: /Users/user/.gradle/caches/transforms-3/3db9d940a0e1f63c8669f0ed70305a71/transformed/work-runtime-2.7.1/META-INF/com/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 17s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
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.work:work-runtime:2.7.1.
AAR metadata file: /Users/user/.gradle/caches/transforms-3/3db9d940a0e1f63c8669f0ed70305a71/transformed/work-runtime-2.7.1/META-INF/com/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
And my build options like this:
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
ndkVersion = "20.1.5948944"
}

flutter master channel issue

Launching lib\main.dart on AOSP on IA Emulator in debug mode...
Running Gradle task 'assembleDebug'...
Warning: The plugin path_provider_android requires Android SDK version 31.
Warning: The plugin shared_preferences_android requires Android SDK version 31.
One or more plugins require a higher Android SDK version.
Fix this issue by adding the following to D:\App Dev Projects\marvelyprojects\android\app\build.gradle:
android {
compileSdkVersion 31
...
}
Parameter format not correct -
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\ashra.gradle\caches\transforms-2\files-2.1\8f42c4deb4a5577a51d166e18b5fb030\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\ashra.gradle\caches\transforms-2\files-2.1\3f788c64cd9fb84deaf5d81b1bbcf4d4\jetified-window-1.0.0-beta04\META-INF\com\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 11s
Exception: Gradle task assembleDebug failed with exit code 1
Following steps fixed the same issue which I was facing on flutter/vscode.
1/..android\app\build.gradle: change 'compileSdkVersion' and 'targetSdkVersion' to 31 (from 30)
2/ above change gave new error ==> ....
build\app\intermediates\packaged_manifests\debug\AndroidManifest.xml:2: AAPT: error: attribute 'package' in tag is not a valid Android package name: 'com.ulusoyapps.sharewhatyouknow.002-navigator2'.
3/ as per https://developer.android.com/guide/topics/manifest/manifest-element.html#package, packagge name was incorrect. I changed it to 'com.ulusoyapps.sharewhatyouknow.a002_navigator2' ,
"package" ==> build\app\intermediates\packaged_manifests\debug\AndroidManifest.xml
"applicationId" ==> android\app\build.gradle
4/ above change gave following error...
BUILD FAILED in 11s
┌─ Flutter Fix ────────────────────────────────────────────────────────────────────────────────────┐
│ [!] Your project requires a newer version of the Kotlin Gradle plugin. │
│ Find the latest version on https://kotlinlang.org/docs/gradle.html#plugin-and-versions, then │
│ update D:\adnan\flutter\ex\Flutter-ShareWhatYouKnow-develop\002-navigator2\android\build.gradle: │
│ ext.kotlin_version = '' │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
5/ changed ext.kotlin_version = '1.3.50' in ... android\build.gradle to 1.6.10

Categories

Resources