Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[android] Plugin [id: 'com.facebook.react.settings'] was not found in any of the following sources #46046

Closed
HamoBoker opened this issue Aug 15, 2024 · 90 comments
Labels
API: Settings Platform: Android Android applications. Resolution: Answered When the issue is resolved with a simple answer

Comments

@HamoBoker
Copy link

Description

build fail on android after upgrading from 0.74.5 to 0.75.1 caused by "/android/settings.gradle' line: 2"

pluginManagement { includeBuild("../../../node_modules/@react-native/gradle-plugin") }
plugins { id("com.facebook.react.settings") }
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
rootProject.name = 'driver'
include ':app'
includeBuild('../../../node_modules/@react-native/gradle-plugin')

i'm using monorepo, i rechecked node_modules path and it is correct

Steps to reproduce

  1. upgrade to react-native@0.75.1
  2. react-native run-android

React Native Version

0.75.1

Affected Platforms

Runtime - Android

Output of npx react-native info

...

Stacktrace or Logs

FAILURE: Build failed with an exception.

* Where:
Settings file '/Users/hamoboker/Projects/shoory/shoory-mobile/apps/driver/android/settings.gradle' line: 2

* What went wrong:
Plugin [id: 'com.facebook.react.settings'] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Included Builds (No included builds contain this plugin)
- Plugin Repositories (plugin dependency must include a version number for this source)

Reproducer

...

Screenshots and Videos

No response

@react-native-bot react-native-bot added Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. API: Settings labels Aug 15, 2024
@react-native-bot
Copy link
Collaborator

⚠️ Missing Reproducible Example
ℹ️ We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.

@react-native-bot react-native-bot added the Platform: Android Android applications. label Aug 15, 2024
@react-native-bot
Copy link
Collaborator

⚠️ Missing Reproducible Example
ℹ️ We could not detect a reproducible example in your issue report. Please provide either:

@jieey1140
Copy link

same issue

@lovegaoshi
Copy link

check your @react-native/gradle-plugin resolution in yarn.lock/package-lock.json; if you have any lingering other than 0.75.1 (eg i have 0.74.1 left in there) you have to remove node_modules and regenerate your lock file

@cortinico
Copy link
Contributor

@lovegaoshi is right. Can you confirm you have @react-native/gradle-plugin version 0.75.1 installed?

@github-actions github-actions bot added Needs: Attention Issues where the author has responded to feedback. and removed Needs: Author Feedback labels Aug 15, 2024
@HamoBoker
Copy link
Author

@lovegaoshi is right. Can you confirm you have @react-native/gradle-plugin version 0.75.1 installed?

I'll recheck and give you feedback

@HamoBoker
Copy link
Author

Thank you @lovegaoshi & @cortinico issue has been solved

@cortinico cortinico added Resolution: Answered When the issue is resolved with a simple answer and removed Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Needs: Attention Issues where the author has responded to feedback. labels Aug 16, 2024
@HamoBoker HamoBoker reopened this Aug 16, 2024
@HamoBoker
Copy link
Author

@cortinico The problem occurred again after reinstalling node_modules.

I created a new project using npx @react-native-community/cli init and faced the same issue. I tried removing ~/.gradle/caches and building again but that didn't solve the problem

Logs from the newly created app

~/Projects/SomeApp git:[main]
yarn android
info A dev server is already running for this project on port 8081.
info Installing the app...

info 💡 Tip: Make sure that you have set up your development environment correctly, by running npx react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor 


FAILURE: Build failed with an exception.

* Where:
Settings file '/Users/hamoboker/Projects/SomeApp/android/settings.gradle' line: 2

* What went wrong:
Error resolving plugin [id: 'com.facebook.react.settings']
> Could not read workspace metadata from /Users/hamoboker/.gradle/caches/8.8/kotlin-dsl/accessors/b22002a57a45d84a557a6d199ea7ef01/metadata.bin

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 596ms
error Failed to install the app. Command failed with exit code 1: ./gradlew app:installDebug -PreactNativeDevServerPort=8081 FAILURE: Build failed with an exception. * Where:
Settings file '/Users/hamoboker/Projects/SomeApp/android/settings.gradle' line: 2 * What went wrong:
Error resolving plugin [id: 'com.facebook.react.settings']
> Could not read workspace metadata from /Users/hamoboker/.gradle/caches/8.8/kotlin-dsl/accessors/b22002a57a45d84a557a6d199ea7ef01/metadata.bin * Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org. BUILD FAILED in 596ms.
info Run CLI with --verbose flag for more details.

@cortinico
Copy link
Contributor

Seems related to: gradle/gradle#28974

I don't have a solution at the moment and I also cannot reproduce:

Screen.Recording.2024-08-16.at.11.04.14.mov

I would have suggested to attempt removing the .gralde/caches folder which you already did.
I'd like to see if other users are also having this problem or not

@cortinico cortinico removed the Resolution: Answered When the issue is resolved with a simple answer label Aug 16, 2024
@Akanzi76

This comment was marked as off-topic.

@Akanzi76
Copy link

/Android/app/build.gradle apply plugin: "com.android.application"
apply plugin: "org.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.com/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"]
    }

/**

  • 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 = 'org.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 = 'org.webkit:android-jsc:+'

android {
ndkVersion rootProject.ext.ndkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdk rootProject.ext.compileSdkVersion

namespace "com.project2"
defaultConfig {
    applicationId "com.project2"
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode 1
    versionName "1.0"
}

signingConfigs {
release {
storeFile file("your-release-key.keystore")
storePassword "1111111" // Key store key enter
keyAlias "your-key-alias"
keyPassword "1111111" // Key store key enter
}
}

buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
}
}

}

dependencies {
// The version of react-native is set by the React Native Gradle Plugin
implementation("com.facebook.react:react-android")

if (hermesEnabled.toBoolean()) {
    implementation("com.facebook.react:hermes-android")
} else {
    implementation jscFlavor
}

}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

@sarwanand24
Copy link

I tried everything listed above but nothing is working.

@jieey1140
Copy link

@sarwanand24

I'm not sure if this will help, but you can also try this

pluginManagement { includeBuild(“../../../node_modules/@react-native/gradle-plugin”) }
plugins { id(“com.facebook.react.settings”) }
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() } 

Change it like below

pluginManagement {
  includeBuild(new File([“node”, “--print”, “require.resolve(‘@react-native/gradle-plugin/package.json’)”].execute(null, rootDir).text.trim()).getParentFile().toString())
}
plugins { id(“com.facebook.react.settings”) }
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }

Test environment
macos 14.4.1 (M1 Pro)
Using pnpm workspace (monorepo)
bare react-native 0.75.1
node 20.16.0

This got me past the above error, but I got an error on the expo-images side, so I downgraded to bare React Native temporarily. If you don't use the above packages, it should work :(

@sarwanand24
Copy link

@jieey1140 I deleted the gradle many times and rebuild the project then it worked for me.

@raahimkhan
Copy link

@lovegaoshi is right. Can you confirm you have @react-native/gradle-plugin version 0.75.1 installed?

This worked for me too!

@devic021
Copy link

I have same issue, no metter what i do, i'm getting same error. Removed /node_modules, .gradle. Tried everything, but the error in Andorid remains.

@pavantank2219
Copy link

pavantank2219 commented Feb 3, 2025

I'm getting the same problem along with 1 other error ...

React native: 0.76.6
Gradle: 8.10.2

* What went wrong:
Error resolving plugin [id: 'com.facebook.react.settings']
> A problem occurred configuring project ':gradle-plugin:react-native-gradle-plugin'.
   > java.util.zip.ZipException: zip END header not found

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
Failed to query the value of property 'buildFlowServiceProperty'.
> Could not isolate value org.jetbrains.kotlin.gradle.plugin.statistics.BuildFlowService$Parameters_Decorated@63ebeda5 of type BuildFlowService.Parameters
   > A problem occurred configuring project ':gradle-plugin:react-native-gradle-plugin'.
      > java.util.zip.ZipException: zip END header not found

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================

@joshua-Wafers
Copy link

Facing same issue
RN: 0.75.4

@NayanSkyWebTech
Copy link

Facing same issue
React: 18.3.1
React-Native: 0.76
Mac OS: 15.1.1
Android Target SDK: 34
Node: 18
JDK: 17

@El-mou33
Copy link

El-mou33 commented Feb 3, 2025

I solved the issue uninstalling the java plugins in VSC, and creating a new project without that plugins

@pavantank2219
Copy link

pavantank2219 commented Feb 3, 2025

I solved the issue uninstalling the java plugins in VSC, and creating a new project without that plugins

@El-mou33 Were you able to fix the issue in existing react-native app ?

@El-mou33
Copy link

El-mou33 commented Feb 3, 2025

I solved the issue uninstalling the java plugins in VSC, and creating a new project without that plugins

@El-mou33 Were you able to fix the issue in existing react-native app ?

I didn't try, my project was really small so it was easy for me restarting the project. Maybe combining other solutions with removing the Java plugins will help. I realised creating a new project in a clean computer that when you install Java plugins on VSC it edits some parts of android graddle folder.

@khushal87
Copy link

Facing same issue on expo ~52.0.28

@Coder-Teddy
Copy link

Image

Facing same issue
React: 18.3.1
React-Native: 0.75.4
Mac OS: 15.1.1
Android Target SDK: 34
Node: 18
JDK: 17

@moraj-gloitel
Copy link

moraj-gloitel commented Feb 3, 2025

Facing same issue

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.

  • Where:
    Settings file '/Users/gloitel/Desktop/Gloitel_work/react-native/FitBattle/android/settings.gradle' line: 2

  • What went wrong:
    Error resolving plugin [id: 'com.facebook.react.settings']

A problem occurred configuring project ':gradle-plugin:react-native-gradle-plugin'.
java.util.zip.ZipException: zip END header not found

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org.
==============================================================================

@OmkarK45
Copy link

OmkarK45 commented Feb 3, 2025

Getting the same issue

➜  android git:(omkar/branch) ✗ ./gradlew clean

Starting a Gradle Daemon, 6 stopped Daemons could not be reused, use --status for details
Configuration on demand is an incubating feature.

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Settings file '/Users/omkar/work/my-app/android/settings.gradle' line: 2

* What went wrong:
Error resolving plugin [id: 'com.facebook.react.settings']
> A problem occurred configuring project ':gradle-plugin:react-native-gradle-plugin'.
   > java.util.zip.ZipException: zip END header not found

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
Failed to query the value of property 'buildFlowServiceProperty'.
> Could not isolate value org.jetbrains.kotlin.gradle.plugin.statistics.BuildFlowService$Parameters_Decorated@401e286b of type BuildFlowService.Parameters
   > A problem occurred configuring project ':gradle-plugin:react-native-gradle-plugin'.
      > java.util.zip.ZipException: zip END header not found

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================

BUILD FAILED in 30s

React Native: 0.76.5
OS: Mac OS Seq
Gradle plugin is not dev dep but present in yarn.lock @0.76.5 resolution as expected

What I tried

  1. Deleting global gradle cache rm -rf ~/.gradle/cache
  2. Deleting android/.gradle folder
  3. cd android && ./gradlew --stop && rm -rf ~/.gradle/caches => This is also not working for me.

@diwakarkumar123
Copy link

same issue i am facing

info Opening app on Android...
info A dev server is already running for this project on port 8081.
info Installing the app...

info 💡 Tip: Make sure that you have set up your development environment correctly, by running npx react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor

FAILURE: Build failed with an exception.

  • Where:
    Settings file '/Users/apple/Diwakar_DEC_Code/DreamFrontend/android/settings.gradle' line: 2

  • What went wrong:
    Error resolving plugin [id: 'com.facebook.react.settings']

A problem occurred configuring project ':gradle-plugin:react-native-gradle-plugin'.
java.util.zip.ZipException: zip END header not found

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org.

BUILD FAILED in 3s
info Run CLI with --verbose flag for more details.

@khushal87
Copy link

Do you have any idea what could have caused this all of a sudden, @cortinico?

@aurangs7
Copy link

aurangs7 commented Feb 3, 2025

Getting this error:

error Failed to install the app. Command failed with exit code 1: ./gradlew app:installDebug -PreactNativeDevServerPort=8081 FAILURE: Build completed with 2 failures. 1: Task failed with an exception.

  • Where:
    Settings file '/Users/MyApp/android/settings.gradle' line: 2 * What went wrong:
    Error resolving plugin [id: 'com.facebook.react.settings']

A problem occurred configuring project ':gradle-plugin:react-native-gradle-plugin'. > java.util.zip.ZipException: zip END header not found

@AkashDoshi19
Copy link

AkashDoshi19 commented Feb 3, 2025

I am able to solve this with following steps:

Follow these steps to resolve it:

Solution Steps

  1. Delete the Gradle Cache Folder
    Remove the cached Gradle files to ensure a clean build:

    C:\Users\<your_username>\.gradle\caches\
    
  2. Delete the .gradle Directory in Your Project
    Navigate to your React Native project's Android directory and delete the .gradle folder:

    C:\Users\<project_directory>\android\.gradle\
    
  3. Clean the Android Build (Optional)
    Open a terminal, navigate to the android folder, and run:

    cd android
    ./gradlew clean  # For macOS/Linux
    gradlew clean    # For Windows
    
  4. Reinstall the React Native Gradle Plugin
    Ensure you have the latest React Native Gradle plugin installed by running:

    npm install @react-native/gradle-plugin
    

After completing these steps, restart your IDE (Android Studio or VS Code) and try running your project again.

This should resolve the issue and allow you to build your React Native app successfully. 🚀

@uutkarshsingh
Copy link

I am able to solve this with following steps:

Follow these steps to resolve it:

Solution Steps

  1. Delete the Gradle Cache Folder
    Remove the cached Gradle files to ensure a clean build:
    C:\Users\<your_username>\.gradle\caches\
    
  2. Delete the .gradle Directory in Your Project
    Navigate to your React Native project's Android directory and delete the .gradle folder:
    C:\Users\<project_directory>\android\.gradle\
    
  3. Clean the Android Build
    Open a terminal, navigate to the android folder, and run:
    cd android
    ./gradlew clean  # For macOS/Linux
    gradlew clean    # For Windows
    
  4. Reinstall the React Native Gradle Plugin
    Ensure you have the latest React Native Gradle plugin installed by running:
    npm install @react-native/gradle-plugin
    

After completing these steps, restart your IDE (Android Studio or VS Code) and try running your project again.

This should resolve the issue and allow you to build your React Native app successfully. 🚀

./gradlew clean is giving this error

Image

@bizIshan
Copy link

bizIshan commented Feb 3, 2025

Image

Same issue, Can any one explain what cause this issue all of sudden ?

@manzoorsofi
Copy link

@bizIshan
i got the same issue today
try
gradlew clean --refresh-dependencies

@jordan-nunes
Copy link

jordan-nunes commented Feb 4, 2025

Hi everyone, my team struggled with this issue today, and we managed to solve it in two different ways. I’m not sure if these methods will work for you, but it’s worth a try!

Solution 1 (My Case):

First, I rebuilt the entire project with the desired version of React Native:

npx @react-native-community/cli init projectname --version 0.76

then

cd projectname

Note: Using community/cli is mandatory; the version is optional.

Then, I ran:

yarn add <all the libraries the project needs>

After that, I ran:

yarn react-native doctor

This ensures everything is set up correctly (everything should show as checked).

Image

Finally, the most important part:

npm run android

Yes, use npm here, not yarn—I don’t know why, but it worked for me!

Solution 2 (For My Friend):

For my friend, this approach didn’t work initially, so we had to take some extra steps:

Delete the node_modules folder.

And run:

yarn install

Then, run:

npm run android

This worked for both of us (with a few additional steps on my friend’s machine). Just make sure that react-native doctor shows everything as checked, otherwise you may face this issue again.

Good luck, keep coding, and be blessed! 🙏

@tanmayR18
Copy link

@jordan-nunes

Sir, I am facing an issue in the existing project ( react-native ~0.75.3 and gradle ~8.8 ). Upgrading to the latest version will cause issues with other libraries ( using CLI ) configuration.

tried almost all the things mentioned above but didn't get any solution :)

@AkashDoshi19
Copy link

I am able to solve this with following steps:
Follow these steps to resolve it:

Solution Steps

  1. Delete the Gradle Cache Folder
    Remove the cached Gradle files to ensure a clean build:
    C:\Users\<your_username>\.gradle\caches\
    
  2. Delete the .gradle Directory in Your Project
    Navigate to your React Native project's Android directory and delete the .gradle folder:
    C:\Users\<project_directory>\android\.gradle\
    
  3. Clean the Android Build
    Open a terminal, navigate to the android folder, and run:
    cd android
    ./gradlew clean  # For macOS/Linux
    gradlew clean    # For Windows
    
  4. Reinstall the React Native Gradle Plugin
    Ensure you have the latest React Native Gradle plugin installed by running:
    npm install @react-native/gradle-plugin
    

After completing these steps, restart your IDE (Android Studio or VS Code) and try running your project again.
This should resolve the issue and allow you to build your React Native app successfully. 🚀

./gradlew clean is giving this error

Image

You can skip 3rd step. Directly install @react-native/gradle-plugin. It should work for you.

@Ankitmujumdar
Copy link

i slove this issue
C:\Users<your_username>.gradle\caches\
./gradlew delete then install @react-native/gradle-plugin then update gradle-wrapper-propeties 8.8 to 8.9 then gradle clean and npm start then your project run properly

@tanmayR18
Copy link

This solution worked for me after 2 days :)

Using react native cli ~0.75.3 and gradle version 8.8

Steps I did

  1. restart pc
  2. delete .android and .gradle from C:\User<username>
  3. deleted .gradle from android of the project folder, node_module, package.lock, yarn.lock
  4. changed 8.8 to 8.9 in gradle-wrapper.properties
  5. npm i
  6. updated this dependencies @react-native/gradle-plugin, react-native-gesture-handler, react-native-safe-area-context and added @react-native-community/cli
  7. Connect the mobile device and toggle usb debugging
  8. cd android and then ./gradlew clean
  9. npm run android

@devlopermitesh
Copy link

i think you need to update your @react-native/gradle-plugin by npm install @react-native/gradle-plugin

@heart2friend
Copy link

Worked for me after installing @react-native/gradle-plugin 0.77 and upgrading distributionUrl to gradle-8.9-all.zip in gradle-wrapper.properties. My project is targeting to React Native version 0.75.3

@mohit1607
Copy link

mohit1607 commented Feb 4, 2025

I got it resolved quickly, I was also irritated at first

I am using Windows 11
This was issue with clearing build cache, So I did it manually

go to C:\Users<Username>\.cache\tooling\gradle

and delete manually all the cache files

any comments and corrections are welcome

@Chaitanya-MandrakeTech
Copy link

I struggled with the issue for 3 days, approximately around 10 to 12 hours. What worked for me was simply upgrading the react-native version.

@Prafullsingh975
Copy link

Prafullsingh975 commented Feb 10, 2025

I struggled with the issue for 3 days, approximately around 10 to 12 hours. What worked for me was simply upgrading the react-native version.

Here is the solution

I was also facing the same problem. My react-native version was 0.75.13. I upgraded it to react-native version 0.77.0 and resolved my issue.

Steps:

  • go to https://react-native-community.github.io/upgrade-helper/
  • Please make the changes that are mentioned.
  • restart the pc
  • go to C:\Users\User_Name/.gradle
  • delete caches and wrapper folder
  • delete node_module and package-log.json
  • do npm i
  • delete debug build
  • run npx react-native run-android
    and my problem was solved

@BirdHarsh
Copy link

BirdHarsh commented Feb 12, 2025

for me issue arrived while starting a new project..
according to RN doc. i did npm uninstall -g react-native-cli @react-native-community/cli ..... this messed my old project so I have to do 'npm install -g react-native-cli @react-native-community/cli' then npm i @react-native/gradle-plugin and update gradle-8.8 to 8.9 in old project... restart vs code... delete android/.gradle folder... then 'npm run android'

@jordan-nunes
Copy link

Hi everyone, it's been a few weeks, and our team has always struggled with this issue every time we need to install a new dependency. Today, I managed to debug it and solve the problem. I’m not sure if this method will work for everyone, but it’s definitely worth a try!

When you build a new project or install a new dependency, before running npm run android, make sure to first install all dependencies using Yarn:

yarn install

Or install the specific dependency you need:

yarn add <your-dependency-here>

Running yarn add will also run yarn install automatically.

After that, you need to upgrade all dependencies with:

yarn upgrade

Finally, the most important part:

npm run android

Yes, use npm here, not Yarn—I’m not sure why, but it worked for me!

Good luck, keep coding, and be blessed! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API: Settings Platform: Android Android applications. Resolution: Answered When the issue is resolved with a simple answer
Projects
None yet
Development

No branches or pull requests