Need help to reduce the react-native file size, my repo is getting heavy.
cd ios
xcodebuild clean
cd android
./gradlew clean
./gradlew cleanBuildCache
I tried both commands but still the same.
node_modules is already in .gitignore
No need to add android/app/build which occupies most of space. These get generated when "run android" command is executed.
Related
I'm facing an error from last day and I could not resolve this, so I decided to share on this network.
actually i started work in react-native was running application very smoothly but now I don't know what is the problem in code, by facing issue "activity class {...} does not exist", but in directory the same file on same path exist too, and as a result build failed...
see this image
Did you try to clean gradlew cache:
cd #projectDir/android
and then
./gradlew clean
Try recreating the android and ios folders and files again. "react-native upgrade" should do the work for you - provided you have not changed anything in the generated files.
npm start --reset-cache
or
react-native start --reset-cache
clean cache memory and delete the previously installed application from your device.
I just upgraded to Xcode 10 and now after attempting to run my existing projects I was met with the below error. After searching I found the following issue when running react native init https://github.com/facebook/react-native/issues/21490. This solution also fixes my issue.
However I am wondering if anyone knows why my current project now require me to run the bundler as a separate instance. It's not the end of the world but it's certainly not the best experience.
Does anyone know of a way the get everything working as it was before without the need to run the following commands:
rm -rf $TMPDIR/react-; rm -rf $TMPDIR/haste-; rm -rf
$TMPDIR/metro-*; watchman watch-del-all
react-native start --reset-cache
(separate terminal) react-native run-ios
I had issues with the build after Xcode update, what I did to fix it is switch the Build System to Legacy Build System
From File > Workspace Settings
Or by pressing on the hammer icon on the right of the status bar
Change the build system to Legacy Build System
Also make sure that you still have the bundle script in Build Phases
Tell me know if that works with you
You may need to add an additional Build Phase to the xCode project after "Bundle React Native code and images"
Add a new build script by selecting the + sign on the top left and selecting "New Run Script Phase" then add the following
if nc -w 5 -z localhost 8081 ; then
if ! curl -s "http://localhost:8081/status" | grep -q "packager-
status:running" ; then
echo "Port 8081 already in use, packager is either not running or not
running correctly"
exit 2
fi
else
open "$SRCROOT/../node_modules/react-
native/scripts/launchPackager.command" || echo "Can't start packager
automatically"
fi
I'm beginner of React native developer.
After create new project then open it.
xcode is display error config.h file not found in mutex.h file. I'm also search in google and try possible solution but still display same error.
I'm done Following Commands
1
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2
brew install watchman
3
npm install -g react-native-cli
4
react-native init projectName
5
cd projectName
react-native start
6
react-native run-ios
Error in CMD
./Desktop/Demo React Native/projectName/node_modules/react-native/React/../third-party/glog-0.3.4/src/base/mutex.h:105:10: fatal error: 'config.h' file not found
include "config.h" // to figure out pthreads support
1 error generated.
Software Version List
Homebrew 1.6.8
react-native-cli: 2.0.1
react-native: 0.55
watchman 4.9.0
npm 6.1.0
I'm also try this soluation but still error
In the Terminal, navigate to the third-party/glog and config glog file
cd node_modules/react-native/third-party/glog-0.3.4
./../scripts/ios-configure-glog.sh
I got it fixed by following this steps:
Close Xcode.
cd <Project-Folder>/node_modules/react-native/third-party/glog-0.3.4
Run ./configure
Run make
Run make install
Open Xcode and try building the Project.
Hope this solves the issue
Solution:
yarn upgrade log
Upgrade to v1.6.0 successful. iOS build successful.
Note: Rebuilding glog did did not work for me. Build failed.
I will add another answer to this issue since it was driving me crazy this week...
$ cd ./node_modules/react-native && scripts/ios-install-third-party.sh && cd third-party && cd $(ls | grep 'glog' | awk '{print $1}') && ./configure
The steps needed to manually configure glog (like samridhgupta his accepted answer or the command I wrote here just above) worked for me, but only the first time I build the project. On every single build I had to go to the same process so I needed a more stable solution.
I appears Xcode is executing ios-install-third-party.sh on every build, which means it will also execute ios-configure-glog.sh every single time. So my solution is to just build a single time, and then comment out the glog install step in the ios-install-third-party script.
If anyone is facing this same issue, it is the line below you need to remove or comment out (ios-install-third-party can be found in /node_modules/react-native/scripts).
fetch_and_unpack glog-0.3.5.tar.gz https://github.com/google/glog/archive/v0.3.5.tar.gz 61067502c5f9769d111ea1ee3f74e6ddf0a5f9cc "\"$SCRIPTDIR/ios-configure-glog.sh\""
If any of these solution does not work, please check your project path. Project path - directory names should not contain any space in its name or you can create project on Desktop or in Documents directory.
Run following commands in project directory.Helped me resolve my config.h not found issue
cd node_modules/react-native/third-party/glog-0.3.4/
./configure
make
make install
cd ../../../..
react-native run-ios
Add this fix script into package.json
"scripts": {
"fix": "cd node_modules/react-native/third-party/glog-0.3.4 && ./configure && make && make install"
},
Then run yarn fix or npm run fix and then try building the Project
My problem was comming from using react-native#0.53.0, which I suppose has trouble with new Xcode version.
1 - Change react-native version in package.json
"react-native": "0.53.0",
to
"react-native": "0.56.0",
2 - Remove node_modules folder
$ rm -rf node_modules/
3 - Reinstall modules:
$ yarn install
What worked for me:
yarn cache clean
rm -rf node_modules
yarn install
I've started to learn react native and I've tried some sample app.The app is installed in emulator and working properly,and I would to share this app with my friends so I've created apk file using generating signed apk
In that reference link they told that,
cd android && ./gradlew assembleRelease
this command (assembleRelease) will bundle all the javascript.Are javascript files alone enough to create apk file?We are running this command inside android folder,wont it take java files?Can anyone please explain in detail what will happen and what are the files bundled after giving the above command.
Hope this URL will help.
https://en.wikipedia.org/wiki/Dalvik_(software)
Look at Architecture part too.
Once keystore file is generated and linked in ~/.gradle/gradle.properties and android/app/build.gradle, running cd android && ./gradlew assembleRelease from root folder (or ./gradlew assembleRelease from android folder) will bundle the app with all necessary files and generate the apk.
You will find the signed apk (app-release.apk) in android/app/build/outputs/apk folder
Hope this helps
Missing android,ios & app folders and index js files
I'm using react native v 0.1.10 in windows 7 OS
We can generate android and ios folder by using upgrade
Run react-native upgrade to generate /ios and /android folders again.
Run react-native link for any native dependency. (if needed)
Finally run
react-native run-ios
or
react-native run-android
Probably you created your project using create-react-native-app, which is an even more simplified toolchain.
You should probably eject if you need android/ios native configs or something.
Please take a look at this doc: https://github.com/react-community/create-react-native-app/blob/master/EJECTING.md
Try this to generate the Android and iOS folder without change version
react-native eject
react-native link
Install a new file using powershell instead of cmd.
Run following commands
1. npx react-native eject
After running above command you can see output in console as follows
info Generating the iOS folder.
info Generating the Android folder.
Next below command
2. npx react-native run-android
Try update ur nodejs and npm to the latest version then run everything again starting from init
npm run eject
next we will get some couple of questions,
? how would you like to eject from create-react-native-app
React-Native : I'd like a regular react native project
? What should your app appear as on a users's home screen? _Your wish____
? What should your Android Studio and Xcode projects be called? rncourse
After Ejected Successfully the project structure will change, added folders android and ios.
happy coding