Home » React-native » How to clean react native project

How to clean react native project

Beginner React-native
How to clean react native project

Hi guys, In this article, we are going to learn about how to clean react native project. I have been working on React native for 4 years. during this time I realize that many issues were reproduced due to old builds data, cache data, for iOS due to pod file issues. there are many other things in react native which can change believer of your project. so, In this article, we will discuss the most common and the first solution for many react native issues.

How to clean react native project

Note: As you know react native works on both Android and iOS. and it uses Android SDK & studio to build configuration & for iOS uses XCode IDE. and React native project root directory contains two folders Android & iOS which contain native projects and during cleaning project we have to run comment inside a particular folder.

1. Cleaning react-native project

To clean the Android project go to the android folder from the project root directory and run the following comment

cd android
./gradlew clean
  • ./gradlew clean : This comment with delete build folder inside Android folder.
  • ./gradlew clean assembleDebug : This comment just runs assembleDebug after cleaning the build folder.

To clean the iOS project go to the ios folder from the project root folder directory and run the following comment

cd ios
xcodebuild clean

2. Auto clean react-native project

If you can clean react native project again and again automatically then add the following comments in package.json inside the scripts section

scripts: { 
  "clean:android": "cd android && ./gradlew clean && cd ../",
  "clean:ios": "cd ios && xcodebuild clean && cd ../", 
}

3. Clean npm

It is very important to clean the npm cache. use following comment to start the development server.

react-native start --reset-cache

Do the above steps to clean your project. comment below if you will get any other issues. We will provide the solutions.

Related Posts

2 thoughts on “How to clean react native project

Leave a Reply

Your email address will not be published. Required fields are marked *