Add Android Support [$50] #94
subtleGradient posted onGitHub
Yes.
<bountysource-plugin>
There is a $50 open bounty on this issue. Add to the bounty at Bountysource. </bountysource-plugin>
http://code.google.com/p/chromium/wiki/AndroidBuildInstructions
https://github.com/paddybyers/anode
Epicness, this'd haz it
It's possible to provide an Android port of node-webkit, but I don't have plan for that in near future, supporting all three major desktop platforms has already taken all of my time.
In case Chrome need V8 Android bridge, it should be done there.
at least three things to do:
- porting Chrome's V8 to node.js.
- cross compile node.js with Android NDK
- poring what else in content-shell to Android
If it's technically possible that would be awesome. Could game developers even use WebGL on Android with this way?
Not sure, I'm not familiar with Chrome on Android.
Hmm... nope. The current version of Android for Chrome doesn't support WebGL :(
@donaldpipowitch , I'm sure it will get better :)
@subtleGradient, why not use Phonegap?
PhoneGap neither uses V8 nor Node. It just uses the native WebView and adds some API bridges.
FIY: Great news. The recent Chrome for Android Beta features WebGL hidden behind a flag: http://blog.tojicode.com/2013/01/get-webgl-working-on-android-chrome-beta.html?m=1
It would be just so sweet to get node-webkit running on an OUYA :)
This is epic if possible :)
Even if it's technically possible to enable node APIs on Andorid, will Google allow such an application being installed? Basically it can access all the resources in the device and user will have no way to control it.
I think you would have to use the regular Android way and declare a AndroidManifest.xml to set permissions.
Meanwhile, the joyent/node#5514 patch has been merged into the core of Node.js.
hi
what s up with node-webkit on android ?
thx
FYI, here is an attempt to provide a pure javascript development environment for native Apps, by using V8 on Android and spider-monkey on iOS. http://sourceforge.net/projects/yaui/
Any progress on this?
If it would be possible to get it working, I may be interested in paying someone (a grand or two?) to get this going. Requirements would be that it has WebGL available (ie latest Chrome).
FYI: With the new JS-to-ObjC-Bridge in iOS7 it should be possible to polyfill Node on iOS, so generally it should be possible to do node-webkit on iOS7, too?
its definitely possible, i have just converted one of my projects from node-webkit to android using the chromium content shell for android from https://github.com/davisford/android-chromium-view doesent have nodejs but the JS bridge works so i was able to recreate the required nodejs functions in java and pass the information back over the bridge.
It would probably need a native app shell and then define a JNI to map webview's js calls to node. (in theory!)
You could probably modify webinos, to emulate node-webkit from what I have read its the chromium content shell smashed together with anode.
https://github.com/webinos/webinos-android
Thanks Albi90
bump
Very interested in html5 nodejs (node-webkit) for my new android tablet
If what you care about is a full-performance Chromium fullscreen window on Android showing your web app, well then I suggest that you look into using Crosswalk (http://www.crosswalk-project.org).
If you really depend on the node.js support, well then you can stop reading here, at least for now :-)
There is even an APK generator here: https://github.com/crosswalk-project/crosswalk-apk-generator.
So what is Crosswalk and does it make sense for you? (some extracts from my upcoming article for html5hub.com)
Crosswalk brings the full performance of Blink/Chromium to web applications on all Android devices from version 4.0 onwards, as well as some additional standards-based web features requested by app developers, such as orientation lock, raw sockets, WebRTC and WebAudio and even WebGL :-)
I guess some readers know that the latest Android (4.4, KitKat) now brings a WebView based on Chrome and Blink, so why not just use that?
Well, the new WebView is only available to people running the latest major version of Android and furthermore, the performance characteristics and features differ somewhat from Chrome, depending on the Android API level used by the embedding application.
This is because the new WebView in KitKat has to match the behavior of the previous WebView to avoid breaking existing applications, which means supporting legacy features, workarounds etc. In some cases this negatively affects layout and performance. In particular canvas performance seems to be hurt and features such as WebGL are left out for now.
As Crosswalk doesn't need this compatibility, it can follow a design very similar to that of the Chrome browser, and it is in fact built on top of Chromium components such as the content module and the Blink engine which makes it blazingly fast and very standards compliant.
What I would like to do is: Do all my development of Android app's on the tablet (Android OS). For me this has two advantages:
1) I don't have to carry around a 4lb laptop.
2) I don't have to run an android simulator and then reconfirm its
actual operation in the Android environment.
Then there is the added time of keeping the simulator in sync
with the Android OS. And the publishing and transfer between
the two platforms. Do I really need all of this complication?
Hi Guys
If you want i have the latest chromium content shell refracted into an android studio project, i cant take any credit for it, its based on Davis Fords github project (now private), but updated.
just add a javascript bridge to communicate between your java and javascript.
Thanks Albi90
Would be great to see node-webkit support for Android and iOS, it would definitely expand node.js to everywhere (already have it running as a pseudo-operating system for embedded devices by killing the window manager on a Raspberry PI, replacing X with a single-window instance of Midori and setting node.js to run automatically, same can be done with a node-webkit application but it makes it a bit harder to update than separating the node.js and web browser instances in that case).
I am with you on this. Want to develop browser based application for local android platform. Working on it now!
On Thu, Apr 17, 2014 at 1:56 PM, CoryGH notifications@github.com wrote:
Would be great to see node-webkit support for Android and iOS, it would definitely expand node.js to everywhere (already have it running as a pseudo-operating system for embedded devices by killing the window manager on a Raspberry PI, replacing X with a single-window instance of Midori and setting node.js to run automatically, same can be done with a node-webkit application but it makes it a bit harder to update than separating the node.js and web browser instances in that case).
— Reply to this email directly or view it on GitHubhttps://github.com/rogerwang/node-webkit/issues/94#issuecomment-40749586 .
Hi guys
if your looking to hax up chromium to create a native web app you can use my latest build of the chromium content shell, its the latest LKGR build 265217 so it should be stable.
just download the source and open it in android studio, this is just the raw content shell which doesn't support loading url's from the assets dir so you will need to zip your project and put some code in to extract it to external storage and set the startup url to file:///extracted_dir well thats what i do if you find a better way let me know.
Have fun
oh yeah the source url is http://squareboxdesign.net/nw/android-chromium-lkgr-rev265217.zip
Woops looks like i didn't re-base to the LKGR correctly the above build is a bit buggy, i will update it tonight, i will also post an example with a basic page utilizing the javascript bridge as it can be hard to work out.
Ok so i have updated the content shell to the latest LKGR 26609 source for the pure content shell is below: http://squareboxdesign.net/nw/android-chromium-lkgr-rev266009.zip
if you want a basic app example, see below node-webkit build (no node.js sorry) this app will extract the node-webkit\chromium\nw\src\main\assets\www content onto the external storage dir and load index.html. the current page is just a simple app that shows the total memory available, the used memory and lists any files in its external storage dir. http://squareboxdesign.net/nw/node-webkit-lkgr-rev266009.zip
it should give you a good example of how to use the JavascriptInterface on the content shell.
FYI my android development skills are not the best so i take no responsibility for any issues.
Feel free to use this code how you like, its 99% chromium source.
Thanks albi90
Any chance to get node-webkit working on android in future ?
@hadim The current situation is the following:
- It is possible to run the Chromium parts of node-webkit on Android, as @albi90 has demonstrated above.
- Node.js engine is somewhat portable to Android as well (especially after the joyent/node#5514 patch has been merged into the core of Node.js).
- The amalgamation of these two (which we know as node-webkit) would still require quite an effort and nobody volunteered to do that.
Ok at least it's clear :-)
Thank you dude !
This might be useful :) Node on android
@No9 interesting gist, if we can simply compile node for android then it shouldn't be to hard to add it to the android content shell, if @zcbenz could provide an in depth breakdown on the changes made to make node work in the content shell at the DOM level i would give it a go, i believe the content shell lib between android and linux shares alot of code.
bump
@rogerwang please say something about this.. This would be the better thing that could happen to node-webkit... node.js and node-webkit are great and thanks to them, programs like PopcornTime were created!! thanks
@PedroMCostaAndrade it requires efforts and the support I get so far is not able to cope with this. Thanks
@rogerwang: When you say "the support I get so far", do you mean fellow developers helping with the code or financial support?
I second @spirodonfl's question and will try to find time to help out if you need code support :+1:
Bump @rogerwang
bump
I don't have the expertise to help with the code, but this would extremely useful for me and I'm willing to pitch in financially (modestly) for someone to do it. Crowdfunding?
I don't know what the exact technical details but this should be doable on the chromium side, proven by the crosswalk project and porting node to android seems to be in progress.
@davidworkman9 It seems to me that the http://instantwebp2p.github.io/node-android/ project is porting Node.js not only to Android, but also from JavaScript to Java, and its intention is to provide Node-like APIs for Java applications on Android. (And it is therefore useless for the goal of launching the code of node-webkit-based applications written in JavaScript.)
@Mithgol oh sorry, I guess you're right. I didn't look into it much, was in the node weekly newsletter this morning right above the notification for this in my inbox and thought it was quite the coincidence.
@Mithgol if we have the API in Java you could simply use the content shell with the js bridge, not as nice as having node tied directly into the content shell at the DOM level but would work.
@albi90 You're right.
@rogerwang I think we should close this as scope creep, doesn't seem like it's within the bounds of the current project to support mobile.
Hello I think it's quite interesting to have NW on Android (and on any mobile env). It's possible to compile NodeJS for Android. Here the result of the build, that runs on Android 5 (should work on 4.4) ARM. Here some explanations in French and here in English (but this one does not support PIE).
I'm also investigate Crosswalk. But there is a big issue with npm and native add-ons.
Great work @dthevenin Do you have any more details on the npm and native add-ons issues? As part of the io-js integration there may be opportunities to submit patches to those projects that facilitate building against multiple node.js forks (Maybe?)
@No9 Thanks :-) There is at least one main issue (I dont know that much how npm works): native add-ons are dynamically built when the user install a npm module that uses native code. That means we need a full build toolchain installed on the Android device. To avoid this issue, the basic idea is to change how npm works, and use a more traditional module approach (like apt-get) that detects the platform and install the right binaries, instead of compiling them. About io.js, yes it would be nice if we are able to patches the project. I will test if it's possible to build io.js for Android...
Why don't you run npm on the host pc/mac and then deploy the "built/npm installed" node app to the device? I think that's a lot easier and should cover most use-cases.
Why don't you run npm on the host pc/mac and then deploy the "built/npm installed" node app to the device? I think that's a lot easier and should cover most use-cases.
Because you would need to shift a binary for every possible architecture, that's the problem. Most Android-apps are written in Java, the JIT-Compiler takes care of the different architectures there.
So if we could compile the native modules to java bytecode (actually you would need to rewrite the native modules in java), putting the native modules right in your app would actually be possible.
Hmm, I think that's not npm's business. You should be able to setup a proper build environment for your app without the need to patch anything on npm's or native modules.
http://developer.android.com/google/play/publishing/multiple-apks.html
Hmm, I think that's not npm's business. You should be able to setup a proper build environment for your app without the need to patch anything on npm's or native modules.
http://developer.android.com/google/play/publishing/multiple-apks.html
+1 for this
@zyberspace You don't have to rewrite the native module. I guest most of them are written using C/C++. We just have to use Android NDK to build them (as I've compiled NodeJS). But for sure is quite complicate to do that on an Android device (for "normal users").
@spacepluk yes It's a npm business. As any package management system, it should be able to manage the device target. For now npm distributes only source code. A npm for mobile env should be able to manage binaries too. But fore sure, it depends on what we want to do with Node. If we want package a App based on Node, WebKit and modules, what you point is enough. If we want propose a dev platform it's not enough.
I'm more interested by the second point, but this is not the purpose of NW!
There are dozens of good uses of node-webkit on Android even without native modules.
If somebody got nw compiled for Android with npm support, that would have been absolutely fine for me. Just the standard modules and require.js for stupid classical JS is already heck of a breakthrough!
get a try node-android, that benefits from both node.js with Rhino JS engine and android framework
Guys, whilst this isn't currently a solution, take a look at the JXCore roadmap, here: https://github.com/Nubisa/jxdocs/issues/153#issuecomment-71417568
This looks like it is going to be a true cross-platform nodejs, Android/iOS included. Will see if it fills the requirements, but there may be a possibility of combining JXCore with Chromium to create node-jxcore?
Just airballing ;)
The above mentioned engine (JXcore) is now said to work on Android (jxcore/jxcore#103).
It currently requires compilation (see its Android_Compile.md
), the binaries do not seem to be available at http://jxcore.com/downloads/
+2 Would be nice to get nwjs fully cross platform, although there would be a alot of overhead 50mb apk. would love to see android support.
And such overhead would be way too unreasonable for a consumer app. Especially those who pay for data used. Makes more sense to port or code compatibility so your app can work with things like Phone Gap or the many other HTML5 container options out there.
@Mithgol I think the easiest way to get this started would be to use Chrome Cordova and extend it. Whats your oppinion?
nwjs doesn't have to be redeployed with each and every app. Instead it should naturally follow the browser model.
Nwjs is installed once, and then apps simply push an Android 'intent' into it with the respective package attached.
That's smoother servicing, minimal data and simpler copy-only apk-less installs at development stage.
That is easier done in theory than execution. I remember when I used to code in classic VB6 / .NET and I was forced to package the runtimes or framework since 50% of my end user issues where them not understanding they need to install them even when the download area stated it. Then you have the case of different versions of NW.js. You can't use the newest because some require an older version for node.js compatibility or even older for an older version of node.js compatibility. For a consumer app, that model only works if NW.js was shipped with the OS. Which I doubt will ever happen.
I think Cordova / Phonegap is a much better solution for Android dev, since it relies on the OS' browser instead of packaging Chromium.
@RIAEvangelist @Montoya There is a project at https://github.com/jxcore/jxcore-cordova and it indends to do just that (i.e. to integrate Node.js as JXcore into Cordova as a plugin).
I think Cordova / Phonegap is a much better solution for Android dev, since it relies on the OS' browser instead of packaging Chromium.
Os browser sucks. It is not updated with latest HTML5 tech. cordova + crosswalk plugin is best setup currently. it packs Chromium into Cordova.
Agree with @v3ss0n Currently building out https://github.com/chromiumify/ for node compatibility
+1
Newest Cordova versions already include the crosswalk solution and thus support the latest HTML5 achievements.
Also, JXcore for Cordova has also reached its goal of bringing Node.js API to Android and to iOS.
Crosswalk bydefault or as plugin?
On Wed, Jul 15, 2015 at 11:59 AM, Mithgol notifications@github.com wrote:
Newest Cordova versions already include the crosswalk solution and thus support the latest HTML5 achievements.
Also, JXcore for Cordova has also reached its goal of bringing Node.js API to Android and to iOS.
— Reply to this email directly or view it on GitHub https://github.com/nwjs/nw.js/issues/94#issuecomment-121492501.
By default, as far as I could tell.
Looks promising. With JXCore as the "Main" process and crosswalk, sans node, as the render process, it may be possible to create a pretty sweet Node.js based mobile app framework. The big key is how efficient the IPC layer is between JXCore and crosswalk.
@Mithgol are you sure? We got to install crosswalk to work.
@JavaScriptDude very interesting.
@v3ss0n When I run cordova build
, build steps for Android seem to involve Crosswalk somehow.
Crosswalk is also mentioned in the official announcement about Apache Cordova Android 4.0.0 (15 Apr 2015).
As you can see from announcement:
Major Changes
- Support for pluggable WebViews!
- Crosswalk can be added by installing the cordova-plugin-crosswalk-webview plugin.
You're right, @v3ss0n. I was wrong to think that Crosswalk is internal to Cordova; in fact a plugin is required.
No problem , i was thinking i am wrong and testing to see if there crosswalk by default.
Hi, Just to add a summary of current (2016) situation :
I practically create an entire app on windows using Node-webkit + HTML5 + sqlite, then I use same exact folder as a base for an android project using the free Intel XDK (https://software.intel.com/es-es/intel-xdk), which uses Cordova. Despite the fact it will not be a native application for Android, it allows me (as per intel-xdx documentation) to publish also in iOS, so practically with NWjs development you now are covering pc, mac, linux, android, iOs. Blackberry is even opening (or already opened, not sure) to publish android apps, so I think we finally have a great option for multi-platform, as you may publish with little changes same app in a web server (node.js) server and connect to a more robust BD (to replace sql) if needed.
Am I right ? or do you guys think we need to wait for more to have a real multi-platform solution ? By the wat, if you want to see app sample is free on google play (hope this will not be considered as spam) here: https://play.google.com/store/apps/details?id=net.LuzEnTuVida (in spanish)
Our experience with IOS , it is broken. IOS devices do not support many CSS3 features that Material Design Lite won't work. Android is fine tho.
iOS 9+ should support more modern CSS if you use a UIWebkit view controller. Doable in 8 but needs a workaround for loading local files. Also, js performance should be an order of magnitude improved. I'm leaning more hybrid app with handrolled mobile-specific normalization nowadays for apps with basic mobile OS needs. Wrapper quirks and unsupported features are as much to learn/overcome as android/iOS shenanigans in a lot of cases.
Wow you are good hero for Smartphones and Tablets!
Very interesting with Android and iOS yeah and where is FirefoxOS, Tizen and BlackArray OS and FreeBSD OS. You know I really miss sometimes node.js and nw.js for FreeBSD - If you have installed FreeBSD / OpenBSD on box than. But FreeBSD is not same Linux because FreeBSD is like so close Darwin ( very unix usable )
For unsupported platform with software-3D ( like old voodoo 3D without graphic cards ) Use only Java Runtime ( Why not ) node.js and nw.js should as *.jar and if your own nw file into jar than you can run jar.
How does sofwtare-3D work? I know it is very slow if you have big 3D project into jar. impossible???
I hope you develop hard
Hi, I successfully run node on crosswalk for Android(Crosswalk provides an alternative for Android WebView), including native node addon.
If any of you are interested, please refer to:
https://docs.google.com/document/d/1OUCesuzWHHQBoeo4vRWunRQjK06qYtOcP5uKfMY0iA8/
I'm trying to implement it as well, @axinging Is that real? Can I develop a Node.js app inside a Crosswalk Webview and deploy it to Android App Store? Do I have to be root? Does it have everyone's to be root?
@matikbird For node js itself, no need to root. For native addon, if you put the addon inside your apk, then no need to root.
Due to android's limitation, if you want to execute native addon at /data/local/tmp, you need to root your devices.
That's amazing, I'm still trying to make it work. Do you have an uploaded example?
I'm speachless. I trully can't believe it's possible.
I mean, if I install, like.. «npm install --save medium-editor» (which's not a native node module, it's fully written in JavaScript), I will be able to do: require('medium-editor')
and it would work? (without using browserify, just plain Node.js)
If that happens, you earned yourself a new fan. Like I said, I'm still trying to make it work, though the guideline it's not very clear.
So far, what I've done to make an hybrid app was: Install Node.js (and NPM), and then: npm install -g cordova. Then, I added the crosswalk plugin.. but that guide it's like another whole new thing.
If I do what I've always done, I don't think Node will be avaible. Can you elaborate how it works? I'll thank you forever. And thanks for the quick reply!
@axinging @matikbird Hi, i'm too interested on this. But i basically not develop mobile or desktop apps, just interest. Let me know if you're done. Thanks. For iOS (WebApp - From Safari, link to home screen) like native or via "Profile Installation" For Android (like iOS send to homescreen), just link bar shows (not good). For WP - IMPOSSIBLE, but via Phonegap can be done (maybe, no NODE, just HTML/CSS/JS) For BB - Exactly like WP.
Just a side note I am using for some time now. You can install node.js and run it on any android phone.
Steps: Install Termux from play store. In Termux use apt install nodejs (it will download and install the arm build for nodejs and npm) now you can use npm and nodejs
Will upload a workable apk soon.
I didn’t try npm’s way. I am not sure if npm works on android. Also, for native addon, they are most built for x86. So for native addon, I bypassed npm, built native module and push it into android devices. But for js addon, it works on rooted devices. For non-rooted devices, I will verify if it works soon.
For crosswalk cordova, node’s support was not officially support. This was just my personal’s interest.
«Yes, but I don't want to install Node.js & NPM in my device» ─ The users, everytime I ask them to install my app.
I meant if it was something like Electron, where you can work with Node.js in a development enviroment, and deploy your apps to all users. Access to LevelDB and stuff, fs filesystem (cordova has it, but whatever). I am not sure if my question was understood, I'm sorry. Now I am more confuse about this.
You can download apk here: https://github.com/axinging/node4android_demo/tree/master/apks. Js addon works on non-rooted devices. One js module sample code: https://github.com/axinging/node4android_demo/tree/master/jsmoduledemo Please put nodeconv.html /sdcard/, and converter.js at /sdcard/node/.
When the apk is started, type: file:///sdcard/nodeconv.html.
There is a Node for Android now called Dory in the Play Store.
bump
@loadbalance-sudachi-kun funded this issue with $256. Visit this issue on Issuehunt
Woah
@rororofff has funded $2.00 to this issue.
- Submit pull request via IssueHunt to receive this reward.
- Want to contribute? Chip in to this issue via IssueHunt.
- Checkout the IssueHunt Issue Explorer to see more funded issues.
- Need help from developers? Add your repository on IssueHunt to raise funds.
My theory is that someone will eventually learn to do something similar to Termux, to find a way to run NW.js (headlessly?) inside an Android application that has a Termux-like environment (basically a Linux/Debian-like environment), and finally pipe the NW.js graphics to an Android Activity (or similar) within the same Android application. Then they'd also need to pipe user events from the Android Activity the other way back to the NW.js instance so it can process them. Maybe there's a better way, but so far that's one way I think is possible.
Apparently people are installing Arch Linux and installing Linux GUI applications inside Termux. https://wiki.termux.com/wiki/Arch
So, the doorways are already open. Someone needs to package it into a convenient helper that takes an NW.js app and bundles it into an app that runs it in that environment. I wonder how GPU support is.
xvfb
is available for Termux. https://github.com/termux/termux-packages/issues/626 and https://github.com/termux/x11-packages/tree/master/packages/xorg-server-xvfb
This means that we can run things like NW.js headlessly.
This is a possible high-level list of steps to take:
- For Termux. https://github.com/termux/termux-app
- Tweak it so that it has pre-installed any regular Linux requirements for running NW.js
- Make a script that takes an NW.js app and bundles it into the Android application.
- Make it so when the Android app starts, it runs the Arch Linux environment (preferably this is installed into the app from a working image, so not always pulling the latest possibly-breaking changes from Arch).
- And when the Arch Environment starts, it should launch the NW app in full screen mode.
Of course, there will be many smaller details to take into consideration.
Another possibility other than using Arch is to use the WIP termux-x11 stuff, or even some other distro. Whoever does this would probably want to try different approaches to see which works best.
A benefit of wrapping NW.js apps in a Termux- Linux-like environment is that NW.js would itself still only support three OSes. Then this would be a wrapper around NW.js. Making NW.js natively support Android would be more ideal, but that might be more difficult (though I could be wrong).