Saturday, August 21, 2010

A couple of useful Mac OS commands

open .

This opens the current directory in a new Finder window.

open -a Preview *.jpg

This opens a new Preview window with all files in current directory ending in 'jpg'.



Thursday, August 5, 2010

Experimenting with google command line utilties

It is really quite nice to be able to perform google services actions from the command line. I've often, in the past, wanted to control one GUI based app or another via a command line. It never was a high enough priority to implement that sort of thing though. I can see this being useful when I want to quickly blog about some new bugget of information I run into. Now I need to find this sort of thing for twitter.

I first posted this message using the google command line tool. I've gone back and fixed a typo plus added a link back to the Google Blog entry which introduces these tools.

Sunday, July 18, 2010

Mac OS X Network Utilities

I ran the "Network Utilities" tool found in my Mac's "Utilities" folder. The "Sent Packets" and "Rcvd" packets are counted since the last system boot.

The way to see the time since last boot is to enter "uptime" in a terminal window.

My uptime as of writing this post is 10 days.

Thursday, June 10, 2010

How to deal with an Android emulator not seen by DDMS or ADB

Sometimes DDMS will not detect that I have the android emulator running. I have found that to solve this problem, I need to restart the emulator with "-wipe-data" parameter. This launches the emulated device with default settings.

"adb -devices" was also failing to show the emulated device.

When you do not specify '-wipe-data', the state of the emulated device is the same as it was last time the emulator was running.

Tuesday, June 8, 2010

Android Instrumentation Testing - A Permission Denial Issue

On a project I am working with, I ran into an issue where the android instrumentation test runner (android.test.InstrumentationTestRunner) was complaining that my test package's signature did not match the signature for the target package. I pulled my hair out for a while trying to figure out what was going on.

Here is the error I got:

INSTRUMENTATION_STATUS: id=ActivityManagerService
INSTRUMENTATION_STATUS: Error=Permission Denial: starting instrumentation ComponentInfo{com.myapp.tests/android.test.InstrumentationTestRunner} from pid=2036, uid=2036 not allowed because package com.myapp.tests does not have a signature matching the target com.myapp
INSTRUMENTATION_STATUS_CODE: -1
java.lang.SecurityException: Permission Denial: starting instrumentation ComponentInfo{com.myapp.tests/android.test.InstrumentationTestRunner} from pid=2036, uid=2036 not allowed because package com.myapp.tests does not have a signature matching the target com.myapp


Solution:

It turned out that the test package's make file had referenced "LOCAL_CERTIFICATE := shared" whereas the target package's makefile was missing this line. I just needed to comment out the LOCAL_CERTIFICATE line so that it matched the target package's makefile.

Apparently, if no certificate directives are given in the makefiles, the android build system defaults to a debug certificate. I have not needed to drill down into the whole signatures topic so far, but this information clears up how to get around the permissions denial issue i was seeing. A google search brought up some information, but not for this specific case. One set of links that got me started though is at a mailing list archive post on osdir.com.

Android's Build Cookbook has some good information mentioning the LOCAL_CERTIFICATE value.

Tuesday, April 20, 2010

Android Package Manager Info

Just spent a dozen minutes or so trying to track down this command line.

adb shell pm

When you type this it will give help information about how to deal with application packages on your Android device. I find the following command line particularly helpful in setting myself up to use the instrumentation test runner tool in the Android SDK.

adb shell pm list instrumentation

Tuesday, February 9, 2010

You Are an Explorer

Saw this on reddit this morning. Like it!