-
Notifications
You must be signed in to change notification settings - Fork 25.1k
Description
Hello
I believe masses of people are very excited about React Native now finally supporting Android too.
BUT there will be a huge disappointment that it does not support developing on Windows machines - which in many cases will prevent the uptake of React Native in bigger companies which can't just change their main OS.
I digged a bit and it seems not to hard to get it running on Windows anyway.
Change from spawn to requirejs.exec in react-native-cli index.js like this:
spawn.exec(cmd + ' ' + args.join(' '), function(code, output){
if (code !== 0) {
cb(new Error('Command exited with a non-zero status ' + code + '\n' + cmd + ' ' + args.replace(',', ' ')));
} else {
cb(null);
}
});
//var proc = spawn(cmd, args, {stdio: 'inherit'});
//proc.on('close', function(code) {
// if (code !== 0) {
// cb(new Error('Command exited with a non-zero status'));
// } else {
// cb(null);
// }
//});
This change enables me to run react-native run-android without any visible errors. It starts the emulator and the app.
The only last missing piece to get it running on Windows is:
Why does the development server not work - or why can't the app connect to it?
I get "Unable to download JS Bundle..." red screen of death. It seems that react-native run-android failed to start it, even though it prints Starting JS server.... See the complete output at the bottom.
So please please, this is such an important issue to have a working Windows version for the uptake of React and should really not be to difficult to fix for you guys.
Please fix it and help us become a huge community.
Cheers
Bernd
Y:\Mobile>react-native run-android
Starting JS server...
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72300Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42300Library UP-TO-DATE
:app:prepareComFacebookFrescoDrawee061Library UP-TO-DATE
:app:prepareComFacebookFrescoFbcore061Library UP-TO-DATE
:app:prepareComFacebookFrescoFresco061Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipeline061Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineOkhttp061Library UP-TO-DATE
:app:prepareComFacebookReactReactNative0110Library UP-TO-DATE
:app:prepareOrgWebkitAndroidJscR174650Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:preDexDebug UP-TO-DATE
:app:dexDebug UP-TO-DATE
:app:validateDebugSigning
:app:packageDebug UP-TO-DATE
:app:zipalignDebug UP-TO-DATE
:app:assembleDebug UP-TO-DATE
:app:installDebug
Installing APK 'app-debug.apk' on 'reactnative(AVD) - 6.0'
Installed on 1 device.
BUILD SUCCESSFUL
Total time: 20.332 secs
Starting the app (adb shell am start -n com.mobile/.MainActivity)...
Starting: Intent { cmp=com.mobile/.MainActivity }