There are some issues in the react-native itself.
the solution to this issue - [https://github.com/facebook/react-native/issues/35210][1]
For react-native ( >= 0.63)
In **android -> build.gradle** add this exclusive Content inside the allprojects.repositories
allprojects {
repositories {
exclusiveContent {
// We get React Native's Android binaries exclusively through npm,
// from a local Maven repo inside node_modules/react-native/.
// (The use of exclusiveContent prevents looking elsewhere like Maven Central
// and potentially getting a wrong version.)
filter {
includeGroup "com.facebook.react"
}
forRepository {
maven {
url "$rootDir/../node_modules/react-native/android"
}
}
}
// ...
}
}
For older react-native (< 0.63)
Add this in the all projects area of your **android -> build.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
}
}
[1]: https://github.com/facebook/react-native/issues/35210
Please follow below steps and check
1. Revert back all the changes you have made after that (downgrade gradle, react-native, java & everything as like before)
2. Delete `node_modules`
3. Delete build folders (`android/build` & `android/app/build`)
4. Recheck the `package.json` if the `react-native` version is as which was worked before (in your case `0.63.3`)
5. Run `npm install` or `yarn` to install packages
6. Clean (remove gradle cache like mentioned here : https://stackoverflow.com/a/30450020/10657559) and rebuild the app by adding the below changes to your `android/build.gradle` file
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-html -->
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())
buildscript {
// ...
}
allprojects {
configurations.all {
resolutionStrategy {
force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
}
}
// ...
}
<!-- end snippet -->
Ref: [Fix and updates on Android build failures happening since Nov 4th 2022 #35210][1]
[1]: https://github.com/facebook/react-native/issues/35210