2

if I try with react-native (npx react-native run-android) I have: enter image description here How to fix it??

1
  • 1
    Images should not be used for textual data, such as code or error messages. Please look over the help center, especially the "How to Ask" article. Commented Nov 7, 2022 at 9:46

1 Answer 1

4

Add the following lines in android/build.gradle

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 {
            force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
        }
    }
}
Sign up to request clarification or add additional context in comments.

8 Comments

thanks this is solve but after I run I got this error execution failed for task ':app:checkDevDebugAarMetadata failed'
share your android/build.gradle code
buildscript { ext { buildToolsVersion = "29.0.3" minSdkVersion = 21 compileSdkVersion = 31 targetSdkVersion = 31 kotlinVersion = '1.6.10' kotlinCoroutinesVersion = '1.6.0' } repositories { google() mavenCentral() jcenter() } dependencies { classpath 'com.google.gms:google-services:4.3.3' classpath("com.android.tools.build:gradle:4.1.0") } }
have you integrated the above code inside your android/build.gradle code?
add full code of android/build.gradle in your question
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.