react-native init YourProjectName
cd YourProjectName
react-native run-ios //for iOS
To reset the cache, do this below
npm start -- --reset-cache
Now trying to run on android, gave the below error
A problem occurred configuring project ':react-native-reanimated'.
> SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at <path>.
this can be easily solved by creating a local.properties file and entering the
sdk.dir = <Android SDK dir>
This may need to be full and not like ~/Library. Instead /Users/<username>/Library/Android/sdk
Now meed tp set the android home directory also, which is like below.
export ANDROID_HOME=~/Library/Android/sdk
Once this is set, good to go. it was running on both Android and iOS
references:
https://stackoverflow.com/questions/44270504/react-native-ios-and-android-folders-not-present#:~:text=android%20and%20ios%20folder%20are,create%20android%20and%20ios%20folder.&text=This%20worked%20for%20me%3A%20Go,both%20environments%20%2D%20User%20and%20Workspace.
No comments:
Post a Comment