Android Emulator

Using real SIM cards with the Android Emulator.

The SEEK project provides patches for the Android emulator and system enabling full communication with real SIM cards in a standard USB PCSC reader.

More information at .

We have created an addon repository for the Android SDK Manager to easily get the patched emulator up and running without the need to compile anything.

Setting up the SDK

To add the repository, launch the SDK Manager and select ToolsManage Add-On Sites...User Defnied SitesAdd and enter this URL:

sorry this will be available soon!!

This will a few new items to the list of available packages:

  • Android 4.2.2 (API 17) / Simhacks x86 System Image
    A system image containing the SEEK userspace libraries as well as the Stk app. This image will work on any host operating system.
  • Extras / Simhacks Emulator
    A modified version of the Android emulator containing the SEEK patches. Binaries for OSX, Linux, and Windows provided.

Creating an AVD


Starting the Emulator

Ensure you have pcscd running and that it detects your reader. You'll then need to start the patched emulator:

$ extras/simhacks/emulator -pcsc @MyAVD

If your SIM card contains STK applets, the SIM Menu app should appear and display your menu:


If you don't trust our binaries or want to make additional changes, you can compile everything yourself.

Follow the standard instructions for Initializing a Build Environment . When it comes time to sync the source code, use our repo manifest:

$ repo init -u

Linux Emulator

See SEEK documentation .

OSX Emulator

The Android Build System works on OSX if you create a case-sensitive disk image . To compile only the emulator without the rest of Android, you can run:

$ PCSC_INCPATH=/System/Library/Frameworks/PCSC.framework/Headers \
  PCSC32_LIBPATH=/System/Library/Frameworks/PCSC.framework/Versions/Current \
  PCSC64_LIBPATH=/System/Library/Frameworks/PCSC.framework/Versions/Current \
  make -j4 emulator-x86

Windows Emulator (Linux Build System)

To cross-compile a Windows emulator on a Linux system:

  1. Install MinGW32.
  2. Copy WinSCard.h, WinSmCrd.h, and scarderr.h from the Windows SDK to the MinGW include directory.
  3. Make symlinks from winscard.h to WinSCard.h and winsmcrd.h to WinSmCrd.h
  4. Add these lines to winscard.h:
    #define __in
    #define __out
    #define __inout
    #define __reserved
    #define __nullterminated
    #define __nullnullterminated
    #define __in_opt
    #define __out_ecount_opt(x)
    #define __in_ecount_opt(x)
    #define __out_opt
    #define __out_bcount(x)
    #define __inout_opt
    #define __in_bcount(x)
    #define __out_bcount_opt(x)
  5. Copy winscard.lib from the Windows SDK to the MinGW library directory.
  6. Hack external/qemu/hw/goldfish_mmc.c to remove calls to ioctl (comment out lines 17, 467, 471, 598, 603-614)
  7. export USE_MINGW=1
  8. build it w/ showcommands
  9. When the final link fails, copy the command line and add a reference to WinSCard.lib