I have messed the files up in the Android folder and would like to rebuild the Android project inside of the Android folder. How do I do this?
Is it safe to delete the Android folder and then run react-native run-android
, will that make it again?
Everything I've coded was wrote in index.android.js
.
react-native link is an automatic way for installing native dependencies. It is an alternative to manually linking the dependency in your project. It works for both Android and iOS.
EDIT: Original answer was written in 2017 (RN v.0.47?). React-native environment evolved and AFAIK this solution is no longer valid.
Probably safe to remove.
I had similar problem, and ./gradlew clean
didn't work, but i found hacky solution from How can I regenerate ios folder in React Native project?
Delete android folder (probably ios too), and then hacky part ->:
react-native upgrade
(it regenerates folders, but it shouldn't be used to upgrade RN..)
And then
react-native link react-native run-android
It worked for me :)
EDIT : one observation -> react-native sometimes goes crazy and cannot run some commands. Launching a new terminal helps. Bizarre :)
The solution if ur version of react-native >= 0.61.0 :
sudo rm -rf android/ ios/
yarn add react-native-eject
npx react-native eject
enjoy !
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With