if I try with react-native (npx react-native run-android) I have:
How to fix it??
1 Answer
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
}
}
}
8 Comments
Anjali Deshmukh
thanks this is solve but after I run I got this error execution failed for task ':app:checkDevDebugAarMetadata failed'
Shivam
share your
android/build.gradle codeAnjali Deshmukh
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") } }
Shivam
have you integrated the above code inside your
android/build.gradle code?Shivam
add full code of
android/build.gradle in your question |