Title:
React Native Release Build Fails: Could not find com.facebook.react:react-android:0.76.7
Description:
I am working on a React Native project, and the debug build works fine. However, when I try to generate a release build using:
cd android && ./gradlew assembleRelease
it fails with the following error:
* Exception is:
.gradle.api.internal.tasks.TaskDependencyResolveException: Could not determine the dependencies of task ':app:lintVitalReportRelease'.
at .gradle.api.internal.tasks.CachingTaskDependencyResolveContext.getDependencies(CachingTaskDependencyResolveContext.java:70)
at .gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:48)
Caused by: .gradle.api.internal.artifacts.ivyservice.TypedResolveException: Could not resolve all dependencies for configuration ':app:releaseCompileClasspath'.
Caused by: .gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com.facebook.react:react-android:0.76.7.
Required by:
project :app
What I Have Tried:
Ensured correct React Native dependency in
package.json
"dependencies": { "react-native": "0.76.7" }
Deleted
node_modules
and reinstalled dependenciesrm -rf node_modules package-lock.json npm install
Cleaned Gradle cache and rebuilt the project
cd android rm -rf .gradle ./gradlew clean ./gradlew --refresh-dependencies cd ..
Checked
android/build.gradle
repositoriesbuildscript { ext { buildToolsVersion = "35.0.0" minSdkVersion = 24 compileSdkVersion = 35 targetSdkVersion = 34 ndkVersion = "26.1.10909125" kotlinVersion = "1.9.24" } repositories { google() mavenCentral() } dependencies { classpath("com.android.tools.build:gradle") classpath("com.facebook.react:react-native-gradle-plugin") classpath(".jetbrains.kotlin:kotlin-gradle-plugin") } } allprojects { repositories { exclusiveContent { filter { includeGroup "com.facebook.react" } forRepository { maven { url "$rootDir/../node_modules/react-native/android" } } } // ... } } apply plugin: "com.facebook.react.rootproject"
- Verified
app/build.gradle
includes the dependency correctlyapply plugin: "com.android.application" apply plugin: ".jetbrains.kotlin.android" apply plugin: "com.facebook.react" /** * This is the configuration block to customize your React Native Android app. * By default you don't need to apply any configuration, just uncomment the lines you need. */ react { /* Folders */ // The root of your project, i.e. where "package.json" lives. Default is '../..' // root = file("../../") // The folder where the react-native NPM package is. Default is ../../node_modules/react-native // reactNativeDir = file("../../node_modules/react-native") // The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen // codegenDir = file("../../node_modules/@react-native/codegen") // The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js // cliFile = file("../../node_modules/react-native/cli.js") /* Variants */ // The list of variants to that are debuggable. For those we're going to // skip the bundling of the JS bundle and the assets. By default is just 'debug'. // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants. // debuggableVariants = ["liteDebug", "prodDebug"] /* Bundling */ // A list containing the node command and its flags. Default is just 'node'. // nodeExecutableAndArgs = ["node"] // // The command to run when bundling. By default is 'bundle' // bundleCommand = "ram-bundle" // // The path to the CLI configuration file. Default is empty. // bundleConfig = file(../rn-cli.config.js) // // The name of the generated asset file containing your JS bundle // bundleAssetName = "MyApplication.android.bundle" // // The entry file for bundle generation. Default is 'index.android.js' or 'index.js' // entryFile = file("../js/MyApplication.android.js") // // A list of extra flags to pass to the 'bundle' commands. // See .md#bundle // extraPackagerArgs = [] /* Hermes Commands */ // The hermes compiler command to run. By default it is 'hermesc' // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc" // // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map" // hermesFlags = ["-O", "-output-source-map"] /* Autolinking */ autolinkLibrariesWithApp() } /** * Set this to true to Run Proguard on Release builds to minify the Java bytecode. */ def enableProguardInReleaseBuilds = false /** * The preferred build flavor of JavaScriptCore (JSC) * * For example, to use the international variant, you can use: * `def jscFlavor = '.webkit:android-jsc-intl:+'` * * The international variant includes ICU i18n library and necessary data * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that * give correct results when using with locales other than en-US. Note that * this variant is about 6MiB larger per architecture than default. */ def jscFlavor = '.webkit:android-jsc:+' android { packagingOptions { pickFirst 'lib/x86/libc++_shared.so' pickFirst 'lib/x86_64/libjsc.so' pickFirst 'lib/arm64-v8a/libjsc.so' pickFirst 'lib/arm64-v8a/libc++_shared.so' pickFirst 'lib/x86_64/libc++_shared.so' pickFirst 'lib/armeabi-v7a/libc++_shared.so' } ndkVersion rootProject.ext.ndkVersion buildToolsVersion rootProject.ext.buildToolsVersion compileSdk rootProject.extpileSdkVersion namespace "com.lmsapp" defaultConfig { applicationId "com.lmsapp" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName "1.0" } signingConfigs { release { if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) { storeFile file(MYAPP_UPLOAD_STORE_FILE) storePassword MYAPP_UPLOAD_STORE_PASSWORD keyAlias MYAPP_UPLOAD_KEY_ALIAS keyPassword MYAPP_UPLOAD_KEY_PASSWORD } } debug { storeFile file('new_keystore.jks') storePassword 'kts@29' keyAlias 'androiddebugkey' keyPassword 'kts@29' } } buildTypes { debug { // signingConfig signingConfigs.release signingConfig signingConfigs.debug } release { // Caution! In production, you need to generate your own keystore file. // see /docs/signed-apk-android. signingConfig signingConfigs.debug minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" } } } dependencies { // The version of react-native is set by the React Native Gradle Plugin implementation("com.facebook.react:react-android") implementation project(':react-native-fs') if (hermesEnabled.toBoolean()) { implementation("com.facebook.react:hermes-android") } else { implementation jscFlavor } } apply from: file("../../node_modules/react-native-vector-icons/fonts.gradle")
My package.json
File:
{
"name": "lmsApp",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"lint": "eslint .",
"start": "react-native start",
"test": "jest",
"postinstall": "npx typesync"
},
"dependencies": {
"@react-native-async-storage/async-storage": "^2.1.1",
"@react-native-google-signin/google-signin": "^13.1.0",
"@react-navigation/bottom-tabs": "^7.2.0",
"@react-navigation/drawer": "^7.1.1",
"@react-navigation/native": "^7.0.14",
"@react-navigation/stack": "^7.1.1",
"@tanstack/react-query": "^5.64.2",
"axios": "^1.7.9",
"hermes-engine": "^0.11.0",
"lottie-react-native": "^7.2.1",
"react": "18.3.1",
"react-native": "0.76.7",
"react-native-animatable": "^1.4.0",
"react-native-blob-util": "^0.21.2",
"react-native-dotenv": "^3.4.11",
"react-native-fs": "^2.20.0",
"react-native-gesture-handler": "^2.22.0",
"react-native-get-random-values": "^1.11.0",
"react-native-image-picker": "^8.2.0",
"react-native-orientation-locker": "^1.7.0",
"react-native-pdf": "^6.7.6",
"react-native-reanimated": "^3.16.6",
"react-native-reanimated-carousel": "^3.5.1",
"react-native-safe-area-context": "^5.0.0",
"react-native-screens": "^4.4.0",
"react-native-share": "^12.0.3",
"react-native-snap-carousel": "^3.9.1",
"react-native-svg": "^15.11.1",
"react-native-svg-charts": "^5.4.0",
"react-native-system-navigation-bar": "^2.6.4",
"react-native-vector-icons": "^10.2.0",
"react-native-video": "^6.9.0",
"react-native-video-player": "^0.15.0-beta.3"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.3",
"@babel/runtime": "^7.25.0",
"@react-native-community/cli": "15.0.1",
"@react-native-community/cli-platform-android": "15.0.1",
"@react-native-community/cli-platform-ios": "15.0.1",
"@react-native/babel-preset": "0.76.5",
"@react-native/eslint-config": "0.76.5",
"@react-native/metro-config": "0.76.5",
"@react-native/typescript-config": "0.76.5",
"@types/babel__core": "~7.20.5",
"@types/babel__preset-env": "~7.9.7",
"@types/eslint": "~9.6.1",
"@types/react": "^18.2.6",
"@types/react-native-dotenv": "~0.2.2",
"@types/react-native-get-random-values": "~1.8.2",
"@types/react-native-snap-carousel": "^3.8.11",
"@types/react-native-svg-charts": "~5.0.16",
"@types/react-native-vector-icons": "^6.4.18",
"@types/react-native-video-player": "~0.10.7",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.6.3",
"eslint": "^8.19.0",
"jest": "^29.6.3",
"prettier": "2.8.8",
"react-test-renderer": "18.3.1",
"typescript": "5.0.4"
},
"engines": {
"node": ">=18"
}
}
Tags:
react-native
gradle
android
dependencies
Title:
React Native Release Build Fails: Could not find com.facebook.react:react-android:0.76.7
Description:
I am working on a React Native project, and the debug build works fine. However, when I try to generate a release build using:
cd android && ./gradlew assembleRelease
it fails with the following error:
* Exception is:
.gradle.api.internal.tasks.TaskDependencyResolveException: Could not determine the dependencies of task ':app:lintVitalReportRelease'.
at .gradle.api.internal.tasks.CachingTaskDependencyResolveContext.getDependencies(CachingTaskDependencyResolveContext.java:70)
at .gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:48)
Caused by: .gradle.api.internal.artifacts.ivyservice.TypedResolveException: Could not resolve all dependencies for configuration ':app:releaseCompileClasspath'.
Caused by: .gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com.facebook.react:react-android:0.76.7.
Required by:
project :app
What I Have Tried:
Ensured correct React Native dependency in
package.json
"dependencies": { "react-native": "0.76.7" }
Deleted
node_modules
and reinstalled dependenciesrm -rf node_modules package-lock.json npm install
Cleaned Gradle cache and rebuilt the project
cd android rm -rf .gradle ./gradlew clean ./gradlew --refresh-dependencies cd ..
Checked
android/build.gradle
repositoriesbuildscript { ext { buildToolsVersion = "35.0.0" minSdkVersion = 24 compileSdkVersion = 35 targetSdkVersion = 34 ndkVersion = "26.1.10909125" kotlinVersion = "1.9.24" } repositories { google() mavenCentral() } dependencies { classpath("com.android.tools.build:gradle") classpath("com.facebook.react:react-native-gradle-plugin") classpath(".jetbrains.kotlin:kotlin-gradle-plugin") } } allprojects { repositories { exclusiveContent { filter { includeGroup "com.facebook.react" } forRepository { maven { url "$rootDir/../node_modules/react-native/android" } } } // ... } } apply plugin: "com.facebook.react.rootproject"
- Verified
app/build.gradle
includes the dependency correctlyapply plugin: "com.android.application" apply plugin: ".jetbrains.kotlin.android" apply plugin: "com.facebook.react" /** * This is the configuration block to customize your React Native Android app. * By default you don't need to apply any configuration, just uncomment the lines you need. */ react { /* Folders */ // The root of your project, i.e. where "package.json" lives. Default is '../..' // root = file("../../") // The folder where the react-native NPM package is. Default is ../../node_modules/react-native // reactNativeDir = file("../../node_modules/react-native") // The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen // codegenDir = file("../../node_modules/@react-native/codegen") // The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js // cliFile = file("../../node_modules/react-native/cli.js") /* Variants */ // The list of variants to that are debuggable. For those we're going to // skip the bundling of the JS bundle and the assets. By default is just 'debug'. // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants. // debuggableVariants = ["liteDebug", "prodDebug"] /* Bundling */ // A list containing the node command and its flags. Default is just 'node'. // nodeExecutableAndArgs = ["node"] // // The command to run when bundling. By default is 'bundle' // bundleCommand = "ram-bundle" // // The path to the CLI configuration file. Default is empty. // bundleConfig = file(../rn-cli.config.js) // // The name of the generated asset file containing your JS bundle // bundleAssetName = "MyApplication.android.bundle" // // The entry file for bundle generation. Default is 'index.android.js' or 'index.js' // entryFile = file("../js/MyApplication.android.js") // // A list of extra flags to pass to the 'bundle' commands. // See https://github/react-native-community/cli/blob/main/docs/commands.md#bundle // extraPackagerArgs = [] /* Hermes Commands */ // The hermes compiler command to run. By default it is 'hermesc' // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc" // // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map" // hermesFlags = ["-O", "-output-source-map"] /* Autolinking */ autolinkLibrariesWithApp() } /** * Set this to true to Run Proguard on Release builds to minify the Java bytecode. */ def enableProguardInReleaseBuilds = false /** * The preferred build flavor of JavaScriptCore (JSC) * * For example, to use the international variant, you can use: * `def jscFlavor = '.webkit:android-jsc-intl:+'` * * The international variant includes ICU i18n library and necessary data * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that * give correct results when using with locales other than en-US. Note that * this variant is about 6MiB larger per architecture than default. */ def jscFlavor = '.webkit:android-jsc:+' android { packagingOptions { pickFirst 'lib/x86/libc++_shared.so' pickFirst 'lib/x86_64/libjsc.so' pickFirst 'lib/arm64-v8a/libjsc.so' pickFirst 'lib/arm64-v8a/libc++_shared.so' pickFirst 'lib/x86_64/libc++_shared.so' pickFirst 'lib/armeabi-v7a/libc++_shared.so' } ndkVersion rootProject.ext.ndkVersion buildToolsVersion rootProject.ext.buildToolsVersion compileSdk rootProject.extpileSdkVersion namespace "com.lmsapp" defaultConfig { applicationId "com.lmsapp" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName "1.0" } signingConfigs { release { if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) { storeFile file(MYAPP_UPLOAD_STORE_FILE) storePassword MYAPP_UPLOAD_STORE_PASSWORD keyAlias MYAPP_UPLOAD_KEY_ALIAS keyPassword MYAPP_UPLOAD_KEY_PASSWORD } } debug { storeFile file('new_keystore.jks') storePassword 'kts@29' keyAlias 'androiddebugkey' keyPassword 'kts@29' } } buildTypes { debug { // signingConfig signingConfigs.release signingConfig signingConfigs.debug } release { // Caution! In production, you need to generate your own keystore file. // see https://reactnative.dev/docs/signed-apk-android. signingConfig signingConfigs.debug minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" } } } dependencies { // The version of react-native is set by the React Native Gradle Plugin implementation("com.facebook.react:react-android") implementation project(':react-native-fs') if (hermesEnabled.toBoolean()) { implementation("com.facebook.react:hermes-android") } else { implementation jscFlavor } } apply from: file("../../node_modules/react-native-vector-icons/fonts.gradle")
My package.json
File:
{
"name": "lmsApp",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"lint": "eslint .",
"start": "react-native start",
"test": "jest",
"postinstall": "npx typesync"
},
"dependencies": {
"@react-native-async-storage/async-storage": "^2.1.1",
"@react-native-google-signin/google-signin": "^13.1.0",
"@react-navigation/bottom-tabs": "^7.2.0",
"@react-navigation/drawer": "^7.1.1",
"@react-navigation/native": "^7.0.14",
"@react-navigation/stack": "^7.1.1",
"@tanstack/react-query": "^5.64.2",
"axios": "^1.7.9",
"hermes-engine": "^0.11.0",
"lottie-react-native": "^7.2.1",
"react": "18.3.1",
"react-native": "0.76.7",
"react-native-animatable": "^1.4.0",
"react-native-blob-util": "^0.21.2",
"react-native-dotenv": "^3.4.11",
"react-native-fs": "^2.20.0",
"react-native-gesture-handler": "^2.22.0",
"react-native-get-random-values": "^1.11.0",
"react-native-image-picker": "^8.2.0",
"react-native-orientation-locker": "^1.7.0",
"react-native-pdf": "^6.7.6",
"react-native-reanimated": "^3.16.6",
"react-native-reanimated-carousel": "^3.5.1",
"react-native-safe-area-context": "^5.0.0",
"react-native-screens": "^4.4.0",
"react-native-share": "^12.0.3",
"react-native-snap-carousel": "^3.9.1",
"react-native-svg": "^15.11.1",
"react-native-svg-charts": "^5.4.0",
"react-native-system-navigation-bar": "^2.6.4",
"react-native-vector-icons": "^10.2.0",
"react-native-video": "^6.9.0",
"react-native-video-player": "^0.15.0-beta.3"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.3",
"@babel/runtime": "^7.25.0",
"@react-native-community/cli": "15.0.1",
"@react-native-community/cli-platform-android": "15.0.1",
"@react-native-community/cli-platform-ios": "15.0.1",
"@react-native/babel-preset": "0.76.5",
"@react-native/eslint-config": "0.76.5",
"@react-native/metro-config": "0.76.5",
"@react-native/typescript-config": "0.76.5",
"@types/babel__core": "~7.20.5",
"@types/babel__preset-env": "~7.9.7",
"@types/eslint": "~9.6.1",
"@types/react": "^18.2.6",
"@types/react-native-dotenv": "~0.2.2",
"@types/react-native-get-random-values": "~1.8.2",
"@types/react-native-snap-carousel": "^3.8.11",
"@types/react-native-svg-charts": "~5.0.16",
"@types/react-native-vector-icons": "^6.4.18",
"@types/react-native-video-player": "~0.10.7",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.6.3",
"eslint": "^8.19.0",
"jest": "^29.6.3",
"prettier": "2.8.8",
"react-test-renderer": "18.3.1",
"typescript": "5.0.4"
},
"engines": {
"node": ">=18"
}
}
Tags:
react-native
gradle
android
dependencies
- "react-native": "15.0.1" <-- this number version aren't applicable in react native release – Fiido93 Commented Mar 11 at 3:28
- It should be "react-native": "0.76.7" – Fiido93 Commented Mar 11 at 3:28
- Tanmay can u share us your source code on build.gradle and app/build.gradle – Fiido93 Commented Mar 11 at 3:35
- I'm sorry, I was trying random things and changing versions. The actual version I'm using is React Native 0.76.7. The issue still persists when running ./gradlew assembleRelease. Do you have any suggestions? – Tanmay Commented Mar 11 at 3:40
- Tanmay please update in the post – Fiido93 Commented Mar 11 at 3:45
1 Answer
Reset to default 0"Starting from React Native 0.71, we're not shipping the /android folder inside the React Native NPM package anymore due to sizing constraints on NPM. The Android artifacts are distributed via Maven Central."
this will help to remove error warning Could not find com.facebook.react:react-android:0.76.7
Need to remove
android/build.gradle
exclusiveContent {
filter {
includeGroup "com.facebook.react"
}
forRepository {
maven {
url "$rootDir/../node_modules/react-native/android"
}
}
}
apply plugin: "com.facebook.react.rootproject"