A longer and more accurate title would be “Installing and running Angular 2 ‘Hello World’ on Android running on a Chromebook that supports the Google Play Store.”
tldr; Can it be done? Yes. Would you want to? Maybe. Are there limitations? Yup.
I have an Acer Chromebook R11, which was one of the first few Chromebooks on an ever expanding list of devices that can run the Google Play Store application. Which means I can install Android applications to varying degrees of success. I got this working a while ago, so I’m not sure if it’s still necessary to enable the Developer Channel to get the update. When I first installed the Play Store, things were pretty buggy, but multiple updates followed quickly and I’m pretty happy with the stability now. Performance is another issue, I’d say my Nexus 6 is definitely snappier launching Android apps and running games. One quirk is launching an Android app that's pinned to the desktop sometimes causes Chrome to crash and a black screen, which clears after a few seconds.
Lately, I got to thinking if it would be possible to develop Angular 2 on my stock Chromebook. By “stock” I mean off the shelf, which I technically violated by adding the dev channel to install the Play Store. But I didn’t want to switch the device into Developer Mode to install Linux, which I’ve done in the past, but I won’t digress. Certainly an easier way to do this would be using Chrome Remote Desktop or remoting into an online virtual machine. I was never smart enough to be satisfied with the easy way.
Lots of challenges to think about in terms of memory management, user permissions and OS limitations; I would be really using the Android OS 6.0.1 running under Chrome OS.
After Googling around, it looked like installing Termux was the best way to get started. Termux is a terminal emulator for Android which also provides plenty of power with “apt” and support for different different shells. The next thing I did in termux was ‘apt-get install node’ which worked like a charm. Then I hit a snag with ‘apt install python’ although I didn’t know it until I tried to create a basic Angular 2 app and was met with the “Python 2.x required” error.
Now I was in a pickle, how to get Python 2.7 installed? The short answer was I shouldn’t have run ‘apt install python’ but ‘apt install python2’. However I wasted a few hours over a couple of days to figure that out. I never did get some of the advanced apt libraries installed (add-apt-repository) but I did figure out how to get to the sdcard from the termux console.
So here’s the basic walk-through, takes a loooong time (10’s of minutes? Didn’t time it, walked away and came back).
Here’s the basic steps;
The open option tells node to open a browser for the app, apparently not needed here. So here it is in all it’s glory… Angular 2 running out of Android on a Chromebook…. Something’s missing, like the browser.
tldr; Can it be done? Yes. Would you want to? Maybe. Are there limitations? Yup.
I have an Acer Chromebook R11, which was one of the first few Chromebooks on an ever expanding list of devices that can run the Google Play Store application. Which means I can install Android applications to varying degrees of success. I got this working a while ago, so I’m not sure if it’s still necessary to enable the Developer Channel to get the update. When I first installed the Play Store, things were pretty buggy, but multiple updates followed quickly and I’m pretty happy with the stability now. Performance is another issue, I’d say my Nexus 6 is definitely snappier launching Android apps and running games. One quirk is launching an Android app that's pinned to the desktop sometimes causes Chrome to crash and a black screen, which clears after a few seconds.
Lately, I got to thinking if it would be possible to develop Angular 2 on my stock Chromebook. By “stock” I mean off the shelf, which I technically violated by adding the dev channel to install the Play Store. But I didn’t want to switch the device into Developer Mode to install Linux, which I’ve done in the past, but I won’t digress. Certainly an easier way to do this would be using Chrome Remote Desktop or remoting into an online virtual machine. I was never smart enough to be satisfied with the easy way.
Lots of challenges to think about in terms of memory management, user permissions and OS limitations; I would be really using the Android OS 6.0.1 running under Chrome OS.
After Googling around, it looked like installing Termux was the best way to get started. Termux is a terminal emulator for Android which also provides plenty of power with “apt” and support for different different shells. The next thing I did in termux was ‘apt-get install node’ which worked like a charm. Then I hit a snag with ‘apt install python’ although I didn’t know it until I tried to create a basic Angular 2 app and was met with the “Python 2.x required” error.
Now I was in a pickle, how to get Python 2.7 installed? The short answer was I shouldn’t have run ‘apt install python’ but ‘apt install python2’. However I wasted a few hours over a couple of days to figure that out. I never did get some of the advanced apt libraries installed (add-apt-repository) but I did figure out how to get to the sdcard from the termux console.
So here’s the basic walk-through, takes a loooong time (10’s of minutes? Didn’t time it, walked away and came back).
Here’s the basic steps;
- apt install nodejs
- apt install python2
- apt install openssh git (not needed yet, but as long as we're installing stuff)
- apt install g++ make
- npm install -g angular-cli
- ng new test-app
- cd test-app
- ng serve --open true
The open option tells node to open a browser for the app, apparently not needed here. So here it is in all it’s glory… Angular 2 running out of Android on a Chromebook…. Something’s missing, like the browser.
Launching Chrome and pointing it at http://localhost:4200 did nothing. I realized the Android's in a sandbox and can’t talk to the Chrome OS, and Chrome OS can’t talk to termux. Next I installed Chrome Beta from the Androind Play Store. Still couldn't start the browser from the command line, but manually started Chrome Beta and loading http://localhost:4200 and voila!
Here’s where I ran into a snag when I tried to create the application on the sdcard. Once termux external storage is setup it creates a linked directory to the sdcard. I thought it would be nice to be able to transfer the memory card between my laptop and Chromebook, Termux has a way to access external storage:
Next I had to figure out an IDE. Ideally something that could read and write directly to the file folder in Termux, which also means something that can be either installed or compiled in Termux. Another option would require an IDE that could work via git (DroidEdit or Zed). The least pleasant solution would be an Android app that could access the shared disk, and would require copying changes back and forth via command line scripts (eeewww).
I tried Debian packages of Microsoft Visula Code, not dice but probably won't work on Android anyway. I did get node-ide and Zed working. Node-ide is interesting and would work in the Termux directory, based on brackets, a bit flakey; the README describes what you need ot run a server but not explicitly so I created ide-server.js for node.
To try this with my ng2 app:
Zed is a Chrome OS App, sounds ideal since it installs right into Chrome, but like DroidEdit, my file location options are limited: Dropbox or Github.
If you like something more hard core, Termux supports vi, vim and gedit.
So can you do Angular 2 devleopment on Chrome OS? Yes.
Would you want to? Maybe with a more powerful Chromebook. I can think of a few limited scenarios where you might actually have a need. Maybe you don't want to lug a full developer laptop on a trip and just want to be able to review and tweak code? Or maybe you're a masochist? I don't judge. But seriously if I had a Chromebook 14 this might not be so bad. In my case, I might be on a business trip and playing with something, and there are strict rules about personal devleopment on company equipment; so I might actually give this a try next month since I don't want to lug two laptops across the country.
Are there limitations? Definitely, such as performance and disk access. The real question is "Are there any show stoppers?" And that I can't answer without trying out a serious Angular app. Maybe this January I'll be able to answer this one during my business trip.
Here’s where I ran into a snag when I tried to create the application on the sdcard. Once termux external storage is setup it creates a linked directory to the sdcard. I thought it would be nice to be able to transfer the memory card between my laptop and Chromebook, Termux has a way to access external storage:
- cd $HOME
- mkdir storage
- apt update && apt upgrade
- termux-setup-storage
Next I had to figure out an IDE. Ideally something that could read and write directly to the file folder in Termux, which also means something that can be either installed or compiled in Termux. Another option would require an IDE that could work via git (DroidEdit or Zed). The least pleasant solution would be an Android app that could access the shared disk, and would require copying changes back and forth via command line scripts (eeewww).
I tried Debian packages of Microsoft Visula Code, not dice but probably won't work on Android anyway. I did get node-ide and Zed working. Node-ide is interesting and would work in the Termux directory, based on brackets, a bit flakey; the README describes what you need ot run a server but not explicitly so I created ide-server.js for node.
To try this with my ng2 app:
- npm install node-ide
- mkdir brackets
- curl -O https://raw.githubusercontent.com/pcimino/brackets/master/ide-server.js
- node ide-server.js
- Launch the Android browser and navigate to
- http://localhost:9092/brackets/
Zed is a Chrome OS App, sounds ideal since it installs right into Chrome, but like DroidEdit, my file location options are limited: Dropbox or Github.
If you like something more hard core, Termux supports vi, vim and gedit.
So can you do Angular 2 devleopment on Chrome OS? Yes.
Would you want to? Maybe with a more powerful Chromebook. I can think of a few limited scenarios where you might actually have a need. Maybe you don't want to lug a full developer laptop on a trip and just want to be able to review and tweak code? Or maybe you're a masochist? I don't judge. But seriously if I had a Chromebook 14 this might not be so bad. In my case, I might be on a business trip and playing with something, and there are strict rules about personal devleopment on company equipment; so I might actually give this a try next month since I don't want to lug two laptops across the country.
Are there limitations? Definitely, such as performance and disk access. The real question is "Are there any show stoppers?" And that I can't answer without trying out a serious Angular app. Maybe this January I'll be able to answer this one during my business trip.