Repository navigation
Description
@nodejs/build, @nodejs/testing and @nodejs/ctc please weigh in.
https://github.com/nodejs/node/search?q=android&type=Issues&utf8=%E2%9C%93 shows 48 issues and PRs referring to Android support in core. This is something that's not on our radar and mostly exists because there are people out there that keep patching it when it doesn't work properly and we just take their word for it.
Android as a target is interesting because there are an increasing number of devices and applications for Android in the wild. Many (most?) development boards support both Linux and Android, Android is being used in all sorts of new places for control and interface applications. Perhaps it's in our interests to start considering something closer to first-class support for it?
I haven't looked into any of the technicalities of this but it may be straightforward to get Android into our build system as a regular part of our test runs. Newer development boards mean that it shouldn't be too slow either (our ARMv7 and ARMv8 Linux targets run at competitive speeds atm and I'd expect the same performance).
So my questions for you all are:
- Is this something you've personally had any experience with?
- Do you have any insight into how Node is being used on Android at the moment?
- Do you have any thoughts on Node + Android to add to what I've listed above?
- Is it worth investing some investigative time on this task at least? (I'm not sure who would do this, while I'd love to do it, I'm probably one of the most time-poor people that could do it).
- Do you have any strong opinions regarding a possible shift toward first-class support of Android (pending investigation and further discussion of course, but initially, what is your reaction to this)?
Activity
shigeki commentedon Mar 22, 2016
I built and made test evaluations of Node on my rooted android about a years ago in nodejs/node#1430. The test coverage were bad. To run tests, it needed to disable PIE to run python as nodejs/node#1396 (comment) and it is very hard to have such devices only for Node developments. Unless we have more better environments to develop Node on android, I think that it is hard to continue supporting.
cablegunmaster commentedon Mar 22, 2016
Yes, well just a small project for school to use a cart system application on a mobilephone, initial setup:
Website -> API->Database.
Mobile phone (Android) -> API ->Database.
Mobile phone (Android) ->Socket.io ->API->Database.
It was fun to do. Wanted a live synchronisation with JSON to push updated list. so a cart system is updated when someone else added a item to it. (say your family ). also for a practicall use try making a chat application with socket.io (works really nice allong).
Socket.io is used as a independent server so you need a Server port and a port open on your mobile phone. Basically its using the socket way of communicating pushing communication along.
http://socket.io/get-started/chat/ -> port open or a environment on the server side where you can control a node server. Look at the example and experiment!
Depends on what you are making. socket.io is only used for making the application respond in Realtime.
Basically it makes your application you are trying to develop more realtime, its only worth building in if it needs to alter in realtime data, lets say weather information, locations of other vehicles on maps (JSON data pushed , and updated). At least this is my analyses from the mobile point of view.
I like socket.io and love to make a game based upon the socket.io framework. but same as you starved for time. Its fun, but you have to wonder if this is the way your application should go upon. Does it need realtime updating? Or is it just because you love the feature?
mhdawson commentedon Mar 22, 2016
In terms of building apps that use javascript for android there is https://cordova.apache.org/ and you can use things like socket.io in those applications. So my initial thinking is that use cases where Node would be used to support a server running on android as opposed to client applications would make a stronger case.
bsegault commentedon Mar 23, 2016
I'll try to answer your questions:
I'm currently working on a multi-platform project that partly relies on Node. Since we want to use smartphones, android is unavoidable; so we built our application for Android (ARM & x86), and recompiled Node.js for Android. So I'm no expert, but I'm working on it =)
Not really. I'm hearing about stuff like Cordova & jxCore, but I don't think that many developers are using Node as-is in Android (because of the structure of an Android package, it's not intuitive to use node in "standard" Android packages, IMHO).
Not really.
I think it's worth investigating how developers can benefit of Node.js on mobile platforms, and what can the community & Node developers do about it. It's no random act that people talk more & more about Cordova & jxCore, though I have no idea of how those work.
lamuertepeluda commentedon Apr 4, 2016
👍 for Android support. I can answer to the questions as well:
@mhdawson with cordova you can just add a socket.io client to your app, but not a server, afaik
dianahinz commentedon Apr 4, 2016
💯
@lamuertepeluda Agree on Jxcore direction. Jxcore did a very good integration with Android. node fs was able to read from APK.
ping @obastemur ! I guess you have the most experience here.
gardner commentedon Apr 13, 2016
It was fun while it lasted but jxcore is no longer maintained. It would be rad if there were jxcore style android-ndk build facilities in nodejs mainline. The cordova plugin makes it easy to create a hybrid app that can connect to the in-process node/jxcore instance.
For an example of a client-server application that runs locally you can checkout the decentralized app patchwork. I have been trying to compile that project for android with little success.
🙇
mihailik commentedon May 18, 2016
I've been using node on Android on Debian chroot as part of using a tablet for development instead of a laptop.
That is, using node-based tools for compiling, inlining, uglifying and self-hosting from a terminal.
Chroot is a royal pain to maintain, otherwise the usage and patterns repeat the pure naked Android nodejs patterns: terminal, localhost:XXXX, browser etc.
The short-term practical production usage limitations are:
On the other hand, easy way of hosting servers on a commodity Android device will be a heaven's blessing for poor countries. Cheap smartphones become a prevalence even in poorest areas, and being able to run school's website from a $40 phone makes a big difference.
gardner commentedon May 19, 2016
I was able to build the node binary for android using the android-configure script in the main repo. You need to download the Android NDK and build from Linux. I used an Ubuntu 15 vm. It builds the node binary which can then be pushed to
/data/local/tmpon the device.My work is available in this repo: https://github.com/gardner/ssband
eljefedelrodeodeljefe commentedon May 19, 2016
I am trying to make some efforts about this. nodejs/node#3098 landed just now and if you guys have other stuff that would be useful upstream, please feel free to give it a shout. I am collecting some info from your links in any case. Thanks!
Trott commentedon Nov 7, 2017
Should this remain open? If so, is there a label that might be useful to add such as
help wanted?rvagg commentedon Nov 9, 2017
FYI I only closed this because there's been no movement. If someone wants to pick this up and figure out a path to better Android support then by all means reopen it or open a new issue.
gardner commentedon Nov 10, 2017
I'm not part of the core group here. In my experience the first ticket to bring up an issue is left open so duplicates can be closed. Since this is the first issue that was logged to track android support, new github issues are closed by referencing #359 as the issue that it duplicates. I understand keeping things tidy but it may be hard to close a new issue as a dup if the original issue that it is duplicating has been closed.
That said, nodejs does build for Android. The
buildrepo does not enable that in any way. I'm not sure if it's worth the effort to move it into this repo unless someone wants it.I guess that's kind of the point @Trott was making. If we leave it open then new folks can see it as a potential way to help.
This was a pretty long comment for my very agnostic view on the matter.
rvagg commentedon Nov 10, 2017
Case made
d3x0r commentedon Jun 29, 2018
I picked up this today; I would like to use node as a .so I can load into some android app.
I can't get it to build at all.
I would think stddef should be able to find bits/c++config.h
but I don't know where that would be defined; it's apparently internal? something --sysroot?
nodejs/node#9707 referenced the same missing .h and there was a modification to add --force installing the standalone toolchain? (that didn't help) I might have missed some other thing that would fix this.
github-actions commentedon Mar 11, 2020
This issue is stale because it has been open many days with no activity. It will be closed soon unless the stale label is removed or a comment is made.