> Task :app:checkDebugAarMetadata FAILED when run react-native run-android - android

I have o change the mincompilesdkversion to 30 and then again to 29 now I am getting this error.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> The minCompileSdk (30) 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.appcompat:appcompat:1.4.0-alpha03.
AAR metadata file: C:\Users\dell.gradle\caches\transforms-2\files-2.1\75e2de9081ba66388e83ea28d3fd2da1\appcompat-1.4.0-alpha03\META-INF\com\android\build\gradle\aar-metadata.properties.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> The minCompileSdk (30) 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.appcompat:appcompat-resources:1.4.0-alpha03.
AAR metadata file: C:\Users\dell.gradle\caches\transforms-2\files-2.1\290cdab22c9c5b1b7c3f8650a9e9566d\jetified-appcompat-resources-1.4.0-alpha03\META-INF\com\android\build\gradle\aar-metadata.properties.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> The minCompileSdk (30) 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.emoji2:emoji2-views-helper:1.0.0-alpha03.
AAR metadata file: C:\Users\dell.gradle\caches\transforms-2\files-2.1\c885669bddbda30b297932769f58904c\jetified-emoji2-views-helper-1.0.0-alpha03\META-INF\com\android\build\gradle\aar-metadata.properties.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> The minCompileSdk (30) 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.emoji2:emoji2:1.0.0-alpha03.
AAR metadata file: C:\Users\dell.gradle\caches\transforms-2\files-2.1\078363885b7b4397f6f0ba1e544abc8e\jetified-emoji2-1.0.0-alpha03\META-INF\com\android\build\gradle\aar-metadata.properties.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> The minCompileSdk (30) 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.core:core:1.7.0-alpha01.
AAR metadata file: C:\Users\dell.gradle\caches\transforms-2\files-2.1\805c250fb9ce03c9ddefabde06af7912\core-1.7.0-alpha01\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 8s
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.bat app:installDebug -PreactNativeDevServerPort=8081
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 (30) 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.appcompat:appcompat:1.4.0-alpha03.
AAR metadata file: C:\Users\dell.gradle\caches\transforms-2\files-2.1\75e2de9081ba66388e83ea28d3fd2da1\appcompat-1.4.0-alpha03\META-INF\com\android\build\gradle\aar-metadata.properties.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> The minCompileSdk (30) 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.appcompat:appcompat-resources:1.4.0-alpha03.
AAR metadata file: C:\Users\dell.gradle\caches\transforms-2\files-2.1\290cdab22c9c5b1b7c3f8650a9e9566d\jetified-appcompat-resources-1.4.0-alpha03\META-INF\com\android\build\gradle\aar-metadata.properties.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> The minCompileSdk (30) 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.emoji2:emoji2-views-helper:1.0.0-alpha03.
AAR metadata file: C:\Users\dell.gradle\caches\transforms-2\files-2.1\c885669bddbda30b297932769f58904c\jetified-emoji2-views-helper-1.0.0-alpha03\META-INF\com\android\build\gradle\aar-metadata.properties.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> The minCompileSdk (30) 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.emoji2:emoji2:1.0.0-alpha03.
AAR metadata file: C:\Users\dell.gradle\caches\transforms-2\files-2.1\078363885b7b4397f6f0ba1e544abc8e\jetified-emoji2-1.0.0-alpha03\META-INF\com\android\build\gradle\aar-metadata.properties.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> The minCompileSdk (30) 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.core:core:1.7.0-alpha01.
AAR metadata file: C:\Users\dell.gradle\caches\transforms-2\files-2.1\805c250fb9ce03c9ddefabde06af7912\core-1.7.0-alpha01\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

If you are coming here after Nov 4/22 where react native released 0.71.0-rc0 and you are unable to build your android project as i was follow this.
📢 Patches for >= 0.63
Releases for all the main versions of react-native with an hotfix:
🛳 0.70.5: https://github.com/facebook/react-native/releases/tag/v0.70.5
🛳️ 0.69.7: https://github.com/facebook/react-native/releases/tag/v0.69.7
🛳 0.68.5: https://github.com/facebook/react-native/releases/tag/v0.68.5
🛳️ 0.67.5: https://github.com/facebook/react-native/releases/tag/v0.67.5
🛳️ 0.66.5: https://github.com/facebook/react-native/releases/tag/v0.66.5
🛳️ 0.65.3: https://github.com/facebook/react-native/releases/tag/v0.65.3
🛳️ 0.64.4: https://github.com/facebook/react-native/releases/tag/v0.64.4
🛳️ 0.63.5: https://github.com/facebook/react-native/releases/tag/v0.63.5
By updating to these patch versions, your Android build should start working again.
To do so, in your package.json change react-native's version to the relevant new patch (ex. if you are on 0.64.3, change to 0.64.4) and run yarn install. No other changes should be necessary, but you might want to clean your android artifacts with a cd android && ./gradlew clean before trying to re-run your Android app.
Fix for older react-native (< 0.63)
The fix above only works on gradle 6.2 and higher. Older react-native used older gradle.
You may determine your gradle version by looking in your /android/gradle/wrapper/gradle-wrapper.properties file.
If you are on an older version of react-native (for example 0.63 or earlier) that uses gradle version 6.1 or below, you must use a different workaround as gradle 6.1 does not support exclusiveContent.
Add this in the allprojects area of your android/buld.gradle file.
def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())
allprojects {
configurations.all {
resolutionStrategy {
// Remove this override in 0.65+, as a proper fix is included in react-native itself.
force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
}
}
More detailed info about the problem and the fix here: https://github.com/facebook/react-native/issues/35210

change these two lines and its now working
this was solution for react-native version .67 and lower
from
compileSdkVersion = 29
targetSdkVersion = 29
to
compileSdkVersion = 30
targetSdkVersion = 30
for latest version here are the changes
buildscript {
ext {
buildToolsVersion = "31.0.0"
minSdkVersion = 21
compileSdkVersion = 33 // with 31 was working fine
targetSdkVersion = 31
if (System.properties['os.arch'] == "aarch64") {
// For M1 Users we need to use the NDK 24 which added support for aarch64
ndkVersion = "24.0.8215888"
} else {
// Otherwise we default to the side-by-side NDK version from AGP.
ndkVersion = "21.4.7075529"
}
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.2.1")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("de.undercouch:gradle-download-task:5.0.1")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
latest updated on react-native version .70 and above
compileSdkVersion = 33
targetSdkVersion = 33

I fixed it by adding this code to the android/app/build.gradle
dependencies{
...other dependencies,
implementation ("androidx.browser:browser:1.3.0"){
force = true
}
}

I found it after 4 hour of searching and testing several answers.
If you don't want to upgrade to SDK 31, add in android/app/build.gradle
android {
...
defaultConfig {
...
configurations.all {
resolutionStrategy { force 'androidx.work:work-runtime:2.6.0' }
}
}
}
Taken form this GutHub answer.

I was facing same issue too.
There was an issue with the library of core-ktx and then I replaced it with this:
implementation("androidx.core:core-ktx:1.6.0")
Change your versions to 30 in app build.gradle:
compileSdkVersion = 30
targetSdkVersion = 30
My issue is resolved may be it helps in your case too.

compileSdkVersion = 31
targetSdkVersion = 31

I'm using RN 0.64.2 version and the react-native-firebase library transitively pulled in the newer version of androidx.browser:browser:1.4.0-alpha01 and androidx.appcompat:appcompat:1.4.0-alpha03.
in my app/build.gradle I forced the androidx.browser:browser and androidx.appcompat:appcompat versions to an earlier ones.
runtimeOnly(group: 'androidx.browser', name: 'browser', version: '1.3.0') {
force = true
}
runtimeOnly(group: 'androidx.appcompat', name: 'appcompat', version: '1.3.1') {
force = true
}

from
buildToolsVersion = "29.0.2"
minSdkVersion = 16
compileSdkVersion = 29
targetSdkVersion = 29
to
buildToolsVersion = "30.0.0"
minSdkVersion = 16
compileSdkVersion = 30
targetSdkVersion = 30
react-native run-android

I have solved the issue by upgrading buildToolsVersion, compileSdkVersion and targetSdkVersion to 31 from 29

Just add this code block to the end of build.gradle file in app level
configurations.all {
resolutionStrategy {
force 'androidx.core:core-ktx:1.6.0'
}
}

In our case: we re-created our react native app
We had a React Native app react-native#0.65.1 with this config
minSdkVersion = 21
compileSdkVersion = 29
targetSdkVersion = 29
We created a new app react-native#0.70.5 and imported the code. the new config was
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 31
We faced the same problem (run android failed), so we changed compileSdkVersion from 31 into 33 and it worked, here is the new config
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 31

Changing compileSdkVersion 28 to compileSdkVersion 30
and targetSdkVersion 28 to targetSdkVersion 30 solved my problem
How you solved this issue

Change like this. Updated.
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
android {
compileSdk 31
defaultConfig {
applicationId "com.example.theblog"
minSdk 28
targetSdk 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
compileSdkVersion 31
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'com.google.firebase:firebase-database:20.0.3'
implementation 'com.google.firebase:firebase-auth:21.0.1'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

The error may also be here.
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
jcenter()
}

Check build error description here

Related

Task :react-native-splash-screen:processDebugAndroidTestManifest FAILED

command i'm trying to run:
./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug
Most of the progress works without failure, but near 90% I get an error message
Error Message:
Task :react-native-splash-screen:processDebugAndroidTestManifest FAILED
[androidx.vectordrawable:vectordrawable-animated:1.0.0] /Users/devingantt/.gradle/caches/transforms-3/8513b8b73b7884b15d157c479782c91b/transformed/vectordrawable-animated-1.0.0/AndroidManifest.xml Warning:
Package name 'androidx.vectordrawable' used in: androidx.vectordrawable:vectordrawable-animated:1.0.0, androidx.vectordrawable:vectordrawable:1.0.1.
/Users/devingantt/Documents/pqaa_detox/node_modules/react-native-splash-screen/android/build/intermediates/tmp/manifest/androidTest/debug/tempFile1ProcessTestManifest1586857056775225339.xml:5:5-74 Error:
uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in library [com.facebook.react:react-native:0.68.2] /Users/devingantt/.gradle/caches/transforms-3/20ecbe39ea883ff454b9d4682071f45b/transformed/jetified-react-native-0.68.2/AndroidManifest.xml as the library might be using APIs not available in 16
Suggestion: use a compatible library with a minSdk of at most 16,
or increase this project's minSdk version to at least 21,
or use tools:overrideLibrary="com.facebook.react" to force usage (may lead to runtime failures)
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-splash-screen:processDebugAndroidTestManifest'.
> Manifest merger failed with multiple errors, see logs
build.gradle
buildscript {
ext {
ext.kotlinVersion = '1.3.40' // (check what the latest version is!)
minSdkVersion = 21
compileSdkVersion = 29
targetSdkVersion = 29
buildToolsVersion = "29.0.2"
}
repositories {
google()
jcenter()
}
dependencies {
classpath('com.android.tools.build:gradle:7.0.2')
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
I'm having trouble understanding the error message as my minSdkVersion is 21 which should be higher than the 16 that appears. Doing a search in the repo for "16" doesn't appear to help either.
I found a working solution on github https://github.com/uxcam/react-native-ux-cam/issues/24#issuecomment-892547229 adding this to build.gradle seems to fix the problem
subprojects {
...
afterEvaluate { subproject ->
if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
}
}
}
}
}

Gradle error when running old Flutter app

I was trying to re-debug my old app, before there was no issue but now there is alot of issues and i can't understand them.
i searched in google for some solution they mostly said its something in the gradle files but cant find the exact one for me so here is my error down there.
sorry if it is a stupid question but i need ur help
this is the error:
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-30).
Dependency: androidx.camera:camera-view:1.0.0-alpha30.
AAR metadata file: C:\Users\youss\.gradle\caches\transforms-3\5e5a33a624d6159ecc9e561e0f352c7c\transformed\jetified-camera-view-1.0.0-alpha30\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-30).
Dependency: androidx.activity:activity:1.4.0.
AAR metadata file: C:\Users\youss\.gradle\caches\transforms-3\f9f5002a34d782344e58c1658fe3e87a\transformed\jetified-activity-1.4.0\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-30).
Dependency: androidx.camera:camera-lifecycle:1.1.0-alpha10.
AAR metadata file: C:\Users\youss\.gradle\caches\transforms-3\53e0fb9fe6f529b4890301eb27dcd339\transformed\jetified-camera-lifecycle-1.1.0-alpha10\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-30).
Dependency: androidx.camera:camera-core:1.1.0-alpha10.
AAR metadata file: C:\Users\youss\.gradle\caches\transforms-3\ddb8413464745d4a1f4035872df7a0c3\transformed\jetified-camera-core-1.1.0-alpha10\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-30).
Dependency: androidx.core:core:1.7.0.
AAR metadata file: C:\Users\youss\.gradle\caches\transforms-3\23c4b0edd799c2e7eef556ade0dea96c\transformed\core-1.7.0\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 9s
this is my gradle.build in my flutter app:
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 30
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.duckanji"
minSdkVersion 21
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
if anything is needed please tell me and please help me thank you people.
Can I know which flutter version are you using for this project? And use complileSdkVersion 31 instead of 30 in your app/build.gradle.
You may try this:
use ext.kotlin_version = '1.5.10' in build.gradle
change compileSdkVersion and targetSdkVersion to 31 in app/build.gradle
in gradle-wrapper.properties change distributionUrl to this distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
Then flutter clean and flutter pub get and run again

Changing the kotlin version results in change in compilesdkversion for some reasons

I cloned a flutter project, and tried to run it on an android device. But I ran into this error:
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\Harshit.gradle\caches\transforms-2\files-2.1\ac98fb722099a50563f635966aedbe29\jetified-window-java-1.0.0-beta04\META-INF\com\android\build\gradle\a
ar-metadata.properties.
The error mentions that the current compileSdkVersion is 30, but some dependency works only with 31.
So, I just changed compileSdkVersion and targetSdkVersion from 30 to 31, in my app-level build.gradle, then I tried to run it again, and I ran into another error:
Task :location:compileDebugKotlin
e: Incompatible classes were found in dependencies. Remove them from the classpath or use '-Xskip-metadata-version-check' to suppress errors
e: C:/Users/Harshit/.gradle/caches/transforms-2/files-2.1/1028a8ca100cbb0fda6fd6257a450fc1/jetified-window-1.0.0-beta04-api.jar!/META-INF/window_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
After a quick google search, I found a fix, that I need to mention the latest kotlin version in android/build.gradle file, so I changed this:
ext.kotlin_version = '1.3.50'
to this:
ext.kotlin_version = '1.6.0'
and downloaded the respective kotlin plugin. Then I tried to run the project again, and I ran into this error:
Execution failed for task ':google_maps_flutter:checkDebugUnitTestAarMetadata'.
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-29).
Dependency: androidx.window:window-java:1.0.0-beta04.
AAR metadata file: C:\Users\Harshit.gradle\caches\transforms-2\files-2.1\9d7a6c54f576894d03496d57f9d5a318\jetified-window-java-1.0.0-beta04\META-INF\com\android\build\gradle\a
ar-metadata.properties.
This error is identical to the first error, except here it mentions that the current compileSdkVersion is 29, even though I didn't change it after setting it to 31.
So, for some reason, upgrading the version of kotlin results in compileSdkVersin being set to 29 automatically, and I have no idea why.
How can I get rid of this error which says the current compileSdkVersion is 29, even though I have it set to 31?
And why does changing kotlin version tricks it into believing that compileSdkVersion is 29, even though its value is set to 31 in build.gradle?
android/build.gradle:
buildscript {
ext.kotlin_version = '1.6.0'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.8'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app/build.gradle:
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 31
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.pranshupandya.locus_stalker"
minSdkVersion 20
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation platform('com.google.firebase:firebase-bom:28.2.0')
implementation 'com.google.firebase:firebase-analytics'
def multidex_version = "2.0.1"
implementation "androidx.multidex:multidex:$multidex_version"
}
apply plugin: 'com.google.gms.google-services'
Try checking the flutter channel using : flutter channel.
If it is beta then change to stable version using : flutter channel stable
Then flutter clean. flutter pub get and then run the project.
Note : Do not try to modify existing kotlin/java configurations for flutter projects.
android {
compileSdkVersion 31 // update to 31 from 30
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.ryx.mallties"
minSdkVersion 21
targetSdkVersion 31 // update to 31 from 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Go to the Project Structure and check your Sdks are rightly mapped to the latest. I had JavaSDK 17 and Android sDK 30
Navigate to your projects build.gradle
Make sure you have these values entered for the
compileSdkVersion
targetSdkVersion
I had them put same values earlier and the error persisted. So make sure they are one less than the other. In short it should be two different versions.

After update lifecyle to version 2.4.0 Make build error AAR metadata file: **/aar-metadata.properties

After update lifecycle version to 2.4.0 i cant build my app the error code is :
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-30).
Dependency: androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0.
AAR metadata file: **/transformed/jetified-lifecycle-viewmodel-ktx-2.4.0/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-30).
Dependency: androidx.lifecycle:lifecycle-livedata-ktx:2.4.0.
AAR metadata file: **/transformed/jetified-lifecycle-livedata-ktx-2.4.0/META-INF/com/android/build/gradle/aar-metadata.properties.
added this code but its not work for me
configurations.all {
resolutionStrategy { force 'androidx.core:core-ktx:1.6.0' }
}
Change compileSdk to 31 and targetSdk 31
if use AGP 7.* or above
android {
compileSdk 30
defaultConfig {
...
targetSdk 30
...
}
...
}
if use AGP Below 7
android {
compileSdkVersion 30
defaultConfig {
...
targetSdkVersion 30
...
}
}

One or more issues found when checking AAR metadata values:

Hey I am trying to run my application and I am getting this error
build.gradle
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
}
android {
compileSdk 30
configurations.all {
resolutionStrategy { force 'androidx.core:core-ktx:1.7.0-alpha01' }
}
defaultConfig {
applicationId "com.example.listadapter"
minSdk 21
targetSdk 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation "com.squareup.retrofit2:converter-moshi:2.5.0"
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation "com.squareup.moshi:moshi:1.12.0"
implementation "com.squareup.moshi:moshi-kotlin:1.12.0"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.4.0"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.0"
implementation "android.arch.lifecycle:extensions:1.1.1"
implementation 'androidx.fragment:fragment-ktx:1.3.6'
}
I tried this All Example from this link it's not working
getting error after installing the application. I just created a new application. I don't understand why this is causing it. Does anyone know how to solve this problem? Thanks in adavance.
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-30).
Dependency: androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0.
AAR metadata file: /Users/vmodi/.gradle/caches/transforms-3/b7f9608e476cb2e496993f185af8912c/transformed/jetified-lifecycle-viewmodel-ktx-2.4.0/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-30).
Dependency: androidx.lifecycle:lifecycle-runtime-ktx:2.4.0.
AAR metadata file: /Users/vmodi/.gradle/caches/transforms-3/538fea46e89a6c8a3e3eec533224abb8/transformed/jetified-lifecycle-runtime-ktx-2.4.0/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-30).
Dependency: androidx.lifecycle:lifecycle-livedata-ktx:2.4.0.
AAR metadata file: /Users/vmodi/.gradle/caches/transforms-3/6a1f77e99280b09902894e4ae8301047/transformed/jetified-lifecycle-livedata-ktx-2.4.0/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-30).
Dependency: androidx.lifecycle:lifecycle-viewmodel:2.4.0.
AAR metadata file: /Users/vmodi/.gradle/caches/transforms-3/41cf6125c3fd7a33d28222cf07d20520/transformed/lifecycle-viewmodel-2.4.0/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-30).
Dependency: androidx.lifecycle:lifecycle-runtime:2.4.0.
AAR metadata file: /Users/vmodi/.gradle/caches/transforms-3/655163560a267a5b16e2f66044d78641/transformed/lifecycle-runtime-2.4.0/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-30).
Dependency: androidx.lifecycle:lifecycle-livedata:2.4.0.
AAR metadata file: /Users/vmodi/.gradle/caches/transforms-3/1ca84d966e72f2f06b580da1765a55a5/transformed/lifecycle-livedata-2.4.0/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-30).
Dependency: androidx.lifecycle:lifecycle-livedata-core-ktx:2.4.0.
AAR metadata file: /Users/vmodi/.gradle/caches/transforms-3/3ed4d52253be7f6d85cbabee72c886d3/transformed/jetified-lifecycle-livedata-core-ktx-2.4.0/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-30).
Dependency: androidx.lifecycle:lifecycle-livedata-core:2.4.0.
AAR metadata file: /Users/vmodi/.gradle/caches/transforms-3/4e8a32482e233cfbbc450e03aabed8dd/transformed/lifecycle-livedata-core-2.4.0/META-INF/com/android/build/gradle/aar-metadata.properties.
If i change my compileSdk 31 it gives me another error.
Could not resolve all files for configuration ':app:androidApis'.
Failed to transform android.jar to match attributes {artifactType=android-mockable-jar, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime, returnDefaultValues=false}.
Execution failed for MockableJarTransform: /Users/vmodi/Library/Android/sdk/platforms/android-31/android.jar.
Cannot create mockable android.jar
/Users/vmodi/Library/Android/sdk/platforms/android-31/android.jar
Change your compileSdk 30 to 31.
It worked for me!
compileSdk 31
defaultConfig {
applicationId "com.example.lifecycle"
minSdk 21
targetSdk 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
In the new version of apps:
Just change the compileSdk from 32 to 33.
compileSdk and targetSdk both should be 31. Have you tried?
Dependency: androidx.lifecycle:lifecycle-runtime-ktx:2.4.0.
The issue is with this dependency, there may be some transitive dependency error. I would suggest use the alpha version of this dependency, worked for me.
Replace with this dependency : androidx.lifecycle:lifecycle-*:2.4.0-alpha03
This is because you just upgraded Kotlin.
Open SDK Manager, install Android 12 (API 31) or above, then change compileSdkVersion to 31 (or above) and change targetSdkVersion to 31 (or above).
Then you will need to change minSdkVersion to 19 as well.
For me setting these two values to API 31 worked
commonCompileSdkVersion = 31
commonTargetSdkVersion = 31
Try to downgrade Kotlin library. I have changed
implementation 'androidx.core:core-ktx:1.9.0'
to
implementation 'androidx.core:core-ktx:1.8.0'
and this resolved my error.
Just remove one dependencies from your Gradle Scripts, then it will be solved.
Open your build.gradle(:app)
Go to dependencies
Remove implementation 'androidx.appcompat:appcompat:1.6.0'
After doing this the problem was solved for me.
If someone is still facing this error, change their compileSdk to 33.
Actually I had a problem : Every time I run my application the AAR metadata will give me an error , so I did this an it worked
go to the left side of the screen and there's an option called "Gradle Scripts "
click on it and there will be many options so click on the second one that says "build.gradle module" click on it and go to the last method named "dependencies"
and in the method there is a line :
implementation 'androidx.appcompat:appcompat:1.5.1'
so delete the " :1.5.1 "
so the line become : implementation 'androidx.appcompat:appcompat'
and it worked for me , I hope it'll work also for you
This WORKED for meset compile sdk from 31 to 33
compileSdk 33
defaultConfig {
applicationId "com.example.happybirthday"
minSdk 21
targetSdk 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

Categories

Resources