Journal Journal: Mobile Hell
I've been trying to write a mobile app for about 5 years. What a fucking joke. Nobody even uses apps anymore.
I mean, sure, we use a few. But what was the last app you downloaded that you regularly use? Probably Facebook or Twitter. Probably not Billy Joe's Bait Shack app. You just go to his fucking website.
Anyway, my company wants an app. It kind of makes sense, and I can certainly do some cool things. But I'm inheriting an app that was already half-assed, and now I have to make it work. I am running
into so many problems.
So here's the specs:
It's an Apache Cordova app with some native parts to Android and iOS. The only other technologies are Backbone.js and Require.js. But it's also about 4 years old and age has not treated it well. And
I'm finding that the tutorials for Cordova apps are shit. So I'm going to try to follow one and see how far I get before I lose my shit.
I am here: https://ccoenraets.github.io/cordova-tutorial/create-cordova-project.html. Please follow along.
I already have Cordova, so I'll update:
$ npm update -g cordova
That worked.
Ok, now I'll create my sample project:
$ mkdir workshop
$ cordova create workshop com.blah.workshop Workshop
Error: Cannot find module 'config-chain'
Uhh. Ok.
$ npm install -g config-chain
$ cordova create workshop com.blah.workshop Workshop
Error: Cannot find module 'umask'
Ok, I see where this is going.
$ npm install -g umask
$ npm install -g npmlog
$ npm install -g uid-number
$ npm install -g which
$ npm install -g npm-registry-client
$ npm install -g chownr
$ npm install -g dezalgo
$ npm install -g npm-cache-filename
$ npm install -g char-spinner
Creating a new cordova project.
Finally! Now I can create my Android platform.
$ cordova platforms add android
Error: Failed to fetch platform android
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Error: Cannot find module 'path-is-inside'
OMFG. More.
$ npm install -g path-is-inside
$ npm install -g fs-vacuum
$ npm install -g async-some
$ npm install -g fs-write-stream-atomic
$ npm install -g fstream-npm
$ npm install -g sha
$ npm install -g normalize-git-url
$ npm install -g realize-package-specifier
$ cordova platforms add android
Finally that's done. Now we can move on with the tutorial.
$ cordova plugin add org.apache.cordova.device
Error: Registry returned 404 for GET on https://registry.npmjs.org/org.apache.cordova.console
You have got to be fucking kidding me. Thankfully, Andre had a useful comment:
For point 8, replace:
cordova plugin add org.apache.cordova.device
cordova plugin add org.apache.cordova.console
with:
cordova plugin add cordova-plugin-device
cordova plugin add cordova-plugin-console
That worked.
$ cordova build android --verbose
Now, I SHOULD be able to run this directly on my plugged in mobile device. I mean, it shows up in chrome://inspect/#devices.
$ adb devices
No devices show up. It says I probably need the USB drivers, but I supposedly have them. So I guess I'll have to copy the file to my phone manually.
But you know what? That works!!!! Thank the fuck Christ. That gives me a Hello World. Now for the hard part...