[Android][linux] Support building/running RN android apps from linux/windows host machine #2693

Closed
kmagiera opened this Issue Sep 14, 2015 · 31 comments

Projects

None yet
@kmagiera
Collaborator

This is master task for linux support of rn android. We've got a lot of issues reported for that, so to summarize:

  1. Only host platform we support is OSX
  2. What seems to be the only holdback are shell scripts (and apple scripts) used in packager and CLI (see #2406 that removes one of that dependency)
@kmagiera kmagiera added the Android label Sep 14, 2015
@kmagiera kmagiera changed the title from [Android][linux] Support running RN android on linux/windows to [Android][linux] Support running RN android apps on linux/windows Sep 14, 2015
@kmagiera kmagiera changed the title from [Android][linux] Support running RN android apps on linux/windows to [Android][linux] Support building/running RN android apps from linux/windows host machine Sep 14, 2015
@SirCmpwn

I was able to get the dev server started, but I get the red screen of death (is that a thing?) because it can't download the JS bundle. Installing iojs, will report back.

@SirCmpwn

I'm running this on a real device, fwiw. Is that supported? Or just the emulator?

@SirCmpwn

Result with iojs:

node_modules/react-native/packager/packager.sh: line 19: 18593 Segmentation fault      (core dumped) node "$THIS_DIR/packager.js" "$@"

So that didn't work.

@ide
Collaborator
ide commented Sep 14, 2015

@SirCmpwn RN 0.11 should support Node (4 and up). When you upgrade Node, clear node_modules and reinstall.

@ayosec
ayosec commented Sep 15, 2015

If anyone is interested in working on this here are some pointers:

So, Facebook is going to support only OSX platforms?

@ide
Collaborator
ide commented Sep 15, 2015

@ayosec It runs on Linux with some small changes (launching the Chrome debugger for example) and with some changes you can get a limited version running on Windows (no Watchman). Most FB programmers use Macs so that naturally receives more attention and dogfooding.

@darkyen
darkyen commented Sep 15, 2015

I am curious why os dependent scripts as opposed to using something like a taskrunner like gulp ? It may involve slightly higher amount of work but the end result is usually easily portable and less bugs + gulp / grunt both have excellent plugins that exist. Also it seems that packager.sh essentially starts packager.js :?

@vjeux
Contributor
vjeux commented Sep 17, 2015

@darkyen: because it was easier to just write down some bash scripts. But indeed we need to move them in js

@despairblue
Contributor

Might be easier to port it to shelljs instead of gulp/grunt/etc.

@kmagiera
Collaborator

@despairblue Seems like shelljs won't solve the issues on windows.

@despairblue
Contributor

I think I missed that, which issues do you mean specifically? Opening chrome seems to be covered by #2406 and invoking gradle (part of react-native-cli, but still mentioning it) can be done via shelljs' exec command even on windows, at least the documentation does not note that exec won't work on windows.

Or do you mean the main problem on windows is not having watchman?

@nikhildaga

Looks like you are willing to support platforms other than OSX. Saved me a 1000+ dollars. Thank you!

@nicolas-despres

I am very interested by the windows support as well. Tks all!

@BerndWessels
Contributor

+1 Basically React-Native for Android works on Windows now if you follow the mentioned issues which have the fixes and workarounds you need to make to get it running.

I am using it on Windows now for about a week and it works great with the simulator and my real Samsung Galaxy S4 device.

I really hope you guys will integrate all the necessary fixes into master soon, so that everybody can start using React-Native and build great components.

Cheers
Bernd

@ippa
ippa commented Sep 22, 2015

Thanks Bernd for your personal interest in getting this matter solved. I'm one of those that got bitten by this, found all the githubissues but is waiting for an official release.

@rockneverdies55

Can someone please tell what exactly needs to be done to develop with react.native on linux?

@mkonicek
Contributor
mkonicek commented Oct 2, 2015

@rockneverdies55 Everything works on Linux except:

  • react-native run-android can't open a new shell window, you need to use react-native start. Will be fixed in next release.
  • Debugging in Chrome currently relies on an AppleScript to launch Chrome. There's a PR to replace that.
@rockneverdies55

Great to hear. Thank you @mkonicek .

I believe this should be stated in getting started guide

@mkonicek
Contributor
mkonicek commented Oct 2, 2015

We'd like to document Linux support once it's fully working.

@mkonicek
Contributor
mkonicek commented Oct 2, 2015

Actually feel free to send a PR to Getting Started that links to this issue.

@beberlei
beberlei commented Oct 8, 2015

Launching the Chrome dev tools is done with an applescript in node_modules/react-native/packager/packager.js calling node_modules/react-native/packager/launchChromeDevTools.applescript. This should probably be converted to a shell script, the following two liner shell script worked for me:

#!/bin/bah
google-chrome $1
@despairblue
Contributor

The script should probably test for different binaries. On arch linux, the
installed binaries could be chromium or google-chrome-stable, the
latter should probably be preferred if installed, though chromium works
just fine as well.

Even preferably is a JavaScript solution in my opinion.

On Thu, Oct 8, 2015, 02:38 Benjamin Eberlei notifications@github.com
wrote:

Launching the Chrome dev tools is done with an applescript in
node_modules/react-native/packager/packager.js calling
node_modules/react-native/packager/launchChromeDevTools.applescript. This
should probably be converted to a shell script, the following two liner
shell script worked for me:

#!/bin/bah
google-chrome $1


Reply to this email directly or view it on GitHub
#2693 (comment)
.


Q: Why is this email five sentences or less?
A: http://five.sentenc.es

@davidgilbertson

@beberlei will that work for Windows?

@beberlei
beberlei commented Oct 9, 2015

@davidgilbertson no, it just works on Linux. We should move that code completly to javascript i guess.

@guillaume86

Karma chrome launcher should be a good place to look at to start.

@PaulBGD
PaulBGD commented Oct 10, 2015

After running everything in git bash and doing sh node_modules/react-native/packager/packager.js to start the server, it looks like it's running nearly perfectly on Windows.

@davidgilbertson

@PaulBGD if you change the package.json start script to "start": "node node_modules/react-native/packager/packager.js" you can then just start the server with npm start.

@PaulBGD
PaulBGD commented Oct 10, 2015

@davidgilbertson Ah okay, I wasn't sure if anything the sh file was doing was important.

@PaulBGD
PaulBGD commented Oct 10, 2015

I noticed @ide said earlier you can get Windows running without watchman, however live reloading and such was working fine for me. Not sure if that's new or not.

@mkonicek
Contributor

The status is now tracked here, feel free to send pull requests: https://github.com/facebook/react-native/blob/master/docs/LinuxWindowsSupport.md

That doc is rendered as part of the website: https://facebook.github.io/react-native/docs/linux-windows-support.html#content

I'll close this issue.

@mkonicek mkonicek closed this Oct 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment