Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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) #327

Closed
HarshMB opened this issue Jan 28, 2022 · 15 comments · Fixed by #340
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@HarshMB
Copy link

HarshMB commented Jan 28, 2022

After adding into latest version of react native project (v0.66.4), i am getting below errors :-

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
53 actionable tasks: 53 executed
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.browser:browser:1.4.0.
    AAR metadata file: /Users/kyatch/.gradle/caches/transforms-3/2ef96b051884931cf6729be3fe4ad115/transformed/browser-1.4.0/META-INF/com/android/build/gradle/aar-metadata.properties.

My react-native-inappbrowser-reborn version is 3.6.3

My other configurations :-

buildToolsVersion = "30.0.3"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
ndkVersion = "21.4.7075529"

@sebcam
Copy link

sebcam commented Jan 31, 2022

you need to set compileSdkVersion = 31

@Ronaldvdh-ISAAC
Copy link

Changing to compileSdkVersion=31 will throw the error:

Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details

The androidmanifest of this library should add the exported property on the activity so we can compile for sdk 31.

@jdnichollsc
Copy link
Member

Hello folks, any pull request is welcome! <3

@jdnichollsc jdnichollsc added enhancement New feature or request help wanted Extra attention is needed labels Jan 31, 2022
@BodaThomas
Copy link

I had the same issue with one of my project. For my part, it was just because i didn't read the installation part of the README.md file.
I forgot to configure the android/build.gradle file, according to the documentation of this repository. If we have the same issue, just read the README.md carrefully, and don't forget to do this step:

Modify your android/build.gradle configuration:

buildscript {
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
ndkVersion = "21.4.7075529"
// Remove 'supportLibVersion' property and put specific versions for AndroidX libraries
androidXAnnotation = "1.2.0"
androidXBrowser = "1.3.0"
// Put here other AndroidX dependencies
}

@vincent-paing
Copy link
Contributor

vincent-paing commented Apr 5, 2022

@Ronaldvdh-ISAAC @jdnichollsc submitted a PR to make it compatible with sdk version 31.

@vincent-paing
Copy link
Contributor

vincent-paing commented Apr 19, 2022

@jdnichollsc could you also make a new release on npm with this fix. We're upgrading to the RN 0.68 which now target sdk 31.

@brunolcarlos
Copy link

How can I set the minCompileSdk (31) with Expo ?
I'm using expo 44

Thank you

@1mehdifaraji
Copy link

This is my build.gradle and the error still appears on my machine :

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

 

// // Remove 'supportLibVersion' property and put specific versions for AndroidX libraries
// androidXAnnotation = "1.2.0"
// androidXBrowser = "1.3.0"
// // Put here other AndroidX dependencies

    ext {
        // supportLibVersion = "28.0.0"
        androidXAnnotation = "1.2.0"
        androidXBrowser = "1.3.0"
        buildToolsVersion = "30.0.2"
        minSdkVersion = 21
        compileSdkVersion = 30
        targetSdkVersion = 30
        ndkVersion = "21.4.7075529"
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:4.2.2")
        classpath('com.google.gms:google-services:4.3.3') // FCM
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenCentral()
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }

        // google()
        maven { url 'https://www.jitpack.io' }
        maven { 
            url 'https://maven.google.com/'
            name 'Google'
        } 
    }
}

@fullsnack-DEV
Copy link

I am also facing the same issue

@ShevO27
Copy link

ShevO27 commented Nov 7, 2022

@1mehdifaraji @fullsnack-DEV check this out guys, might be related facebook/react-native#35210

@rakesho-firstlight
Copy link

Try upgrading your current RN version to the latest version of same version you are using, there seems to be issue with RN since last Friday. For more details, pls check - facebook/react-native#35210

@POLO79160
Copy link

regardez plutôt cette vidéo (simple et efficace) et le problème est résolu, voici le lien

https://www.youtube.com/watch?v=4gUzUuk9X0k

@ParmarJigarr
Copy link

@fullsnack-DEV I am Also facing same issue any solution ?

@1mehdifaraji
Copy link

1mehdifaraji commented Feb 20, 2023

I solved the issue by adding this piece of code at the end of dependencies inside android/app/build.gradle :

android/app/build.gradle

dependencies {
    ....
    ....
    api(group: "androidx.work", name: "work-runtime") {
        version {
            strictly "2.7.0-alpha04"
        }
    }
}

And this is android/build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "30.0.2"
        minSdkVersion = 21
        compileSdkVersion = 30
        targetSdkVersion = 30
        ndkVersion = "21.4.7075529"
        androidXCore = "1.7.0" // <-- Add this. Check versions here: https://developer.android.com/jetpack/androidx/releases/core
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:4.2.2")
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenCentral()
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }

        google()
        maven { url 'https://www.jitpack.io' }
    }
}

@ParmarJigarr
Copy link

@1mehdifaraji Thanks for response, i resolve this issue by change version from 30 to 31 and upgrade some npms !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.