Celebrate the 15,000th downloads of AndroidShell! - 2010-10-9


What is it?

  1. Simply speaking, it enables you to play with any Android APIs at your PC but see their immediate execution results on your phone, such that you can grasp the APIs more rapidly than simply reading documents
  2. Technically speaking, it is a port of BeanShell to Android.
See here for snapshots of AndroidShell in action.

Who will need it?

Anyone who want to learn how to develop applications on Android smartphones will find this small tool helpful.
To be noticed, you need to have a basic understanding of how to use Android SDK before starting to enjoy the benefits of AndroidShell. Completing the official "hello world" tutorial is the minimum recommended prerequisites.

Where to download

On your Android phone, search for "AndroidShell" in Android Market.  There are a free version and a full version. See here for the difference.

Supported Android phone models

I tested it on HTC hero (Android 1.5), Moto XT800( Android 2.1) and the emulators in Android SDK. I believe it will work on all Android phones with Android OS version >=1.5.

How to start?

If you are an impatient reader and just want to have a quick try, you can use the local console on the AndroidShell itself without setup the PC environment. However, I highly encourage you to use the more easy-to-use PC based console which requires you to complete some configuration steps as below) 
  1. First, you should have installed Android SDK and the adb USB driver (included in the Android SDK) on your PC. And since you have had Android SDK, I assume you should also have installed JRE as well.
  2. On your Android phone, search the free "AndroidShell" app in Android Market and install it.  There is also a paid full version, which provides some extra conveniences for users. See here for detail
  3. To be noticed, this app will ask for all Android system defined permissions. Don't panic. This is harmless and just to enable you to play with arbitrary Android APIs later.
  4. Enable the remote debug support in your phone's setting.
  5. Start the installed app on the phone (or emulator)
  6. Note down the httpd and sessiond port number as showed in the first two lines of the app window. Let's suppose they are 1035 and 1036 respectively
  7. Connect your Android phone to your PC with USB cable. 
  8. On your PC, open a command window. Suppose your Android SDK is installed at C:android_sdk
  9. "cd c:android_sdk ools"
  10. "adb forward tcp:1035 tcp:1035"
  11. "adb forward tcp:1036 tcp:1036"
  12. The above two commands maps your local 1035/1036 tcp port to the 1035/1036 port of the phone. If unfortunately, your local 1035/1036 tcp port is already occupied, you could select any two consecutive spare tcp ports instead. Refer to the adb help for more detail.
  13. Let's note down the lower local tcp port you have mapped to as local_port (i.e 1035 in previous example)
  14. Now click here to access the console page
  15. Read Tutorial page for some quick examples how you can play with it

Known issues

  • You can not define your own class in AndroidShell yet (however, you could use scripted object mechanism to define implementations of any interface. See the "Manipulation of Android GUI" example in the tutorial section).


How is it related to the Android Scripting Environment(ASE)?

There is also a port of BeanShell to Android by the ASE. I believe my AndroidShell is somewhat more convenient than it.
  • I didn't find a way in the BeanShell of ASE to invoke arbitrary Android APIs. It did support certain Android APIs by wrapping them to a proxy class to BeanShell, but you can invoke are just the ones exposed by that class. But with AnroidShell you could directly use any Anroid APIs.
  • With BeanShell of ASE, you can only type command on the phone, but AndroidShell allows you to type command from your PC.
If you think AndroidShell is useful, please help spread the word.