Category Archives: Android

Google Pixel “No command” error – FIXED!

I recently received a Google Pixel through my employer to do Android testing on.  It’s a wonderful device, sleek, fast, beautiful screen.  A week ago I had to switch the device off due to traveling on a plane, and when switching it back on again, it did not boot correctly, instead showing a little Android mascot, with the words “No command” underneath.  I was baffled, but after a few hours of Googling and trying different things, I eventually found the fix.


For reference, the device I have is a Google Pixel 32GB, model “2PW4100” it says at the bottom of the back panel, and the build number ended up being “NOF26V”.  This is a stock device, no rooting, no funny bootloader unlocks or anything, out the box, and minimal software installed.


I can’t be 100% sure.  Haven’t a clue actually.


So after rummaging around on Google and everywhere it lead me to, I didn’t find an actual “Oh hey, got the ‘No command’ problem?  Here’s the fix: xyz” solution, there were several “try this” and “try that” type things, and as these things go, hardly ever any kind of feedback.  I did end up fixing the phone though, without losing any data.  The solution is to do a manual OTA (Over-The-Air) update.  The steps to follow requires slight familiarity with the command line of your operating system.

Tools you will need

You will need a PC or laptop running either Windows, Linux or MacOS, and the appropriate USB cable for your phone (In the Google Pixel’s case, it’s a USB Type-C cable, the one that came with the phone for charging works just fine.) . You will also need a command line utility called “adb“, which is the Android Debug Bridge.  Luckily, as of this year, instead of having to download the whole Android Software Development Kit, you can download adb by itself here.  Extract the zip file somewhere.  If you’re running Windows, then firstly, I’m sorry.  Secondly, you may need the Google/Android USB drivers which you can find here.

Steps to follow

  • Switch your phone on if it is not already switched on.
  • On the “No command.” screen, keep the power button in, then press Volume Up.  This will present you with the Android Recovery menu.
  • BE CAREFUL!  On this menu, there are some destructive options, such as Factory Reset etc.
  • At the top of the screen, you will see a few lines of yellow text, followed by several menu items in blue.  Look at the yellow text, and look for the version/build number, which will be in a format similar to: “7.1.0/NOF26V/1234567” – That “NOF26V” is the build number you’re after.
  • Go find the build number on the Google “Full OTA Images” page.  The page lists downloadable OTA images for all the currently Google-supported phones.  In my case, the build number “NOF26V” was found twice on the page, once for the Google Pixel XL (codename marlin), and once for the Google Pixel (codename sailfish).
  • Click the appropriate link to download the (as at time of writing) ±850mb zip file for your phone.
  • Once the file is downloaded, copy it to the same location as where you extracted the “adb” tool earlier, open up your favourite command line terminal tool, and navigate to where the adb and the OTA zip file is.
  • If you haven’t done so already, connect the phone to your computer using the USB cable.
  • Confirm that the adb tool can see your phone by typing “adb devices” into the command line.  The output should show a serial number on the left, and “recovery” on the right.
  • On your phone, which should still be on the Android Recovery screen, using the Volume Down button to navigate to the “Apply update from ADB” option, and press the Power button once to select.  The phone will prompt you to start sending the update using ADB.
  • In the command line tool, type the following: “adb sideload <>“, in my case, the downloaded OTA zip file was called ““, so my command line was: “adb sideload”
  • There will be some progress appearing on your computer, and some progress displaying on the phone as well.  After a minute or two, the update should be complete, and you will be able to select an option on the Recovery menu again.
  • NOTE!  Do not be alarmed if you see a warning about “Unknown volume for path” at the end of the update, this is not a critical problem and does not mean the update failed.
  • Use the Volume Up/Down buttons to navigate to the “Reboot” option at the top, and press the Power button to confirm selection.
  • The phone should reboot correctly now and start up as per normal, with all data and everything still there.
  • Once you’ve logged into the phone, there will be a short period of “Completing Android Update” in your notification tray as the last bits of the OTA update is completed.


And that’s that.

Let me know if the above worked for you, or if you have any questions.

Disallow debug logging in Android release build

Android_Robot_200So I’ve been doing a lot of Android development over the past several months, and came across the question of how to provide debug logging for a debug build of the library/app I’m working on, but to not let those debug logs flow through to the release build.

At first I mistakenly assumed that, hey, it’s a release build, so surely Log.d and Log.v calls won’t show up?  Wrong.  Android release builds don’t care about debug level, they’ll show whatever logging, at whatever logging level you tell it to.

So at first I sat and thought how I could fix the problem.  I came up with a few options:

  1. I could do what the Android Developer guide suggests one does, and comment out all my debug log lines before building a release build.  Ya, right, uh, no.
  2. I could wrap all the debug log lines with if(BuildConfig.DEBUG) { … }, but that felt unnecessarily painful to have to do.
  3. I could create my own Log class, with its own logic on when to actually log (such as a point 2 above, at the very least), and then just call the android.util.Log methods, but that kind of felt like overkill, as surely the expectation to have intelligent logging on Android is not that wrap the existing logging with your own…
  4. I could switch to old familiar Log4J (or Android equivalent); but yuck, that’s _really_ overkill just to get some logging on for an Android library.
  5. I could write some preprocessor and inject it into the gradle build process, that would go and strip out all the debug log calls to Log.v and Log.d, but, well, that felt like something somebody else would have done already (The world being full of lots of clever people and all…)

I then took to Google, and of course came upon several StackOverflow (Good ol’ SO) questions on the problem, and some good solutions.  It took a bit of reading, and finding more questions and answers before I found the exact solution that worked for me.  With one slight small caveat, which I’ll mention later.  Read on to hear about what I ended up using as a solution.

Continue reading

My Android development learnings so far

So I’ve been doing a lot of online courses on Javascript (and JS frameworks like Bootstrap and AngularJS), as well as a bunch of courses on Android Development.  Both from and  I received a 1 year access to via New Relic in return for adding their management agent to my hosting server, and there are several freely available Android courses at Udemy, and I bought a couple when they were $10 each during the new year sale on Udemy.  The nice thing about both Udemy and Learnable, is that you receive a completion certificate once you complete a course.  I’m gathering all my certificates on my Learnings page.

I must say that Android development does seem rather straight forward, or, at least, what I’ve seen so far.  I’ve done many beginner courses, and busy going through a couple of the more intermediate and advanced courses, including a Lollipop dev course, and the way of coding is nice and concise, not a lot of guesswork involved.  I’m even using Android Studio instead of the Eclipse ADT, but still getting used to the differences.

My next step is to code up a few native applications and get them onto the Google Play Store.  Strangely enough, my biggest stumbling block so far has been to figure out under what name I want to release the apps.  Hehe.  Choosing a name is an important step!

And no, all of this learning I’m doing has nothing to do with my work-life, there is no reason I need to know these technologies for work, this is purely for self-enrichment.  I love coding, and there is not a lot of opportunity where I am at the moment, to learn or implement new things like this, so I have to keep up with it in my own time.

Wirelessly deploying test applications to Android device

Are you tired of having to plug your Android device into your Mac or PC while debugging changes?

I use Titanium Studio from Appcelerator for both Android and iOS development, and came across the following trick on how not have to keep your Android device plugged in via USB during development.

* I am going to assume you’ve deployed a test version of your app to your device at least once using a USB cable.
* I am also going to assume you have a wireless accesspoint that your device is connected to, and your PC or Mac is connected to (PC or Mac do not need to be on wireless, just connected to the same network as the wireless AP)
* One last assumption is that you know what your Android device’s IP number is on the wireless network.

Now follow these steps to start deploying your apps wirelessly to your device:

  1. Plug your device into USB one last time.
  2. Open your command prompt (cmd.exe or and check that your device is connected using abd devices
  3. Switch your adb daemon to tcpip instead of USB mode by running: adb tcpip 5555
  4. Now get adb to connect to your device by running: adb connect x.x.x.x:5555 (Replacing x.x.x.x with your device’s IP number)
  5. You can now disconnect your device from USB, and you will be able to confirm that your device is available by running: adb devices as per normal

And that’s that.  In Titanium Studio, make sure to select the “Refresh Devices” option on the Run Configurations dropdown so your device appears on the list.

Note: You may need to follow the steps above again if you reboot your PC/Mac, and you may also need to periodically run “abd connect x.x.x.x:5555” if you go for lengthy periods without deploying anything to your device, as the connection is terminated after a while.

Another note: In case you didn’t realise, the above steps work for Android devices only.

One last note, to switch adb back to normal USB mode, simply run “adb usb“.


Migrating data (and apps2sd!) between SD cards on HTC Hero

Normally migrating data from an older, smaller SD card to a bigger one on any Android phone is a simple affair:

  • Connect USB cable to phone
  • Choose “Connect as drive” on phone
  • Backup files from USB device onto PC/Mac using your favourite file manager on your PC/Mac
  • Disconnect device from PC/Mac
  • Disconnect USB cable
  • Unmount SD card (Main menu -> SD card storage -> Unmount
  • Replace old SD card with new SD card
  • Reconnect USB cable
  • Choose “Connect as drive” on phone
  • Copy data back
  • Disconnect device from PC/Mac
  • Disconnect USB

All well and good, nice and simple.
BUT! What if you’ve been toying with your phone and flashing custom roms and, here’s the big one, what if you have apps2sd enabled?  Those apps are installed on an ext partition which you can’t just easily get access to.

Well, it’s not that difficult actually. Two assumptions here are that you’ve rooted your phone, and also installed (a relatively recent) version of the Amon Ra Recovery Image for your phone.
Continue reading