How can I reset Android/iOS project in React Native? Like in Ionic, we can use "ionic platform rm android" & then add it again, so it will add fresh project. How I can do same in React Native?
            Asked
            
        
        
            Active
            
        
            Viewed 6,269 times
        
    1
            
            
        - 
                    These links might help you. For Android: https://stackoverflow.com/questions/43214862/how-to-rebuild-the-entire-android-folder For ios: https://stackoverflow.com/questions/42506068/how-can-i-regenerate-ios-folder-in-react-native-project – Chandan Kumar Jan 29 '18 at 12:51
3 Answers
4
            
            
        I had issues with Pod dependencies or Cocoapods in iOS. Removing and de-integrating CocoaPods from my project fixed it.
gem install cocoapods-deintegrate
cd ios
pod deintegrate
pod install
 
    
    
        Gianfranco P.
        
- 10,049
- 6
- 51
- 68
1
            
            
        Just remove folder ios/build for ios, and android/build. For android you may also need cd ./android && ./gradlew clean in some cases.
If you can create command inside package.json like
 "clear-android": "rm -rf android/build",
 "clear-ios": "rm -rf ios/build"
 
    
    
        Oleksandr Cherniavenko
        
- 1,475
- 8
- 14
1
            
            
        To reset android build, delete cache and refresh you may need to do the following
If you have already generated signed keys and updated those in the gradles, you can build the production build, unless you can build the developer build (debugging apk)
- Delete buildinsideandroid/appfolder
- Delete buildinsideandroidfolder
- run rm -rf $HOME/.gradle/caches/to delete cache
- Open build.gradle->android/app/build.gradle
- comment out this line apply from: "../../node_modules/react-native/react.gradle"
- Delete index.android.bundlefile fromassetsfolder( android/app/src/main/assets/index.android.bundle)
- run following command react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
- react-native run-android --variant=release(you have to generate signed keys and all the keys should updated in the gradle file ref (https://s-pace.github.io/react-native/docs/signed-apk-android.html)
- if you dont have generate signed keys still you can run react-native run-android
 
    
    
        noone
        
- 6,168
- 2
- 42
- 51
