Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Error While Running React Native App

I am facing the below error form yesterday when I am trying to run the project.

Execution failed for task ':app:checkDEVDebugAarMetadata'.

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-alpha01.
     AAR metadata file: /Users/mac/.gradle/caches/transforms-2/files-2.1/fafe0388b6cc91ea7309174cddb01b56/browser-1.4.0-alpha01/META-INF/com/android/build/gradle/aar-metadata.properties.

Please help if anyone know this fix without update compileSdkVersion.

like image 334
Diptesh Atha Avatar asked Sep 16 '21 12:09

Diptesh Atha


People also ask

What port does React Native run on?

The Metro bundler runs on port 8081. If another process is already using that port, you can either terminate that process, or change the port that the bundler uses.

Can we run React Native app on browser?

Can React Native be used for web and mobile? Yes! With React Native for Web, developers can write a single React Native application that can run natively on Android and iOS, as well as on a web browser using standard web technologies.


Video Answer


4 Answers

I just fixed the issue with below code added to my android/app/build.gradle file inside android block:

android{ 

    // ....Existing codes

    configurations.all {
            resolutionStrategy {
                force 'androidx.browser:browser:1.2.0'
            }
        }
}

Hope it help others as form September 15, 2021 a new version released for androidx.browser:1.4.0-alpha01 it contains minSDK version 31, it may causes the error.

like image 171
Diptesh Atha Avatar answered Oct 25 '22 02:10

Diptesh Atha


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
    }
}

This happens because there is an recent update to the androidx.browser as of September 15, 2021 that require minSDK 31

like image 39
KX Jaw Avatar answered Oct 25 '22 01:10

KX Jaw


You can also specify which version of androidx.browser you want to use in android/build.gradle like this:

buildscript {
  ext {
    ...other versions
    androidXBrowser = "1.3.0"
  }
}
like image 30
Jake Johnson Avatar answered Oct 25 '22 01:10

Jake Johnson


Add following config to android/app/build.gradle

defaultConfig {
   // ... existing config
    configurations.all {
        resolutionStrategy { force 'androidx.browser:browser:1.3.0' }
    }
}
like image 20
m4r00p Avatar answered Oct 25 '22 02:10

m4r00p