Thursday, November 15, 2007

How to Install APK Files on Android Device Emulator

In this tutorial we want to explain how to install APK-files to an Android device emulator. Thus you will be able to test already now all new application which will start to appear soon. When the actual Android-powered devices will appear (approximately beginning of 2008), they must be also compatible with already available till then applications.


For the whole experiment you will need two things:


  1. a Windows, Mac OS X (intel) or Linux (i386) powered computer
  2. the Android Software Development Kit (SDK).

You do not need Eclipse or Eclipse-plugin the Android Development Tools (ADT). The last two are required for the software development for Android, but are not necessary for application evaluation on emulator.


At first let's go and download the Android SDK, which may be obtained here: http://code.google.com/android/download.html

Follow the instruction, described in the topic "Installing SDK" from the Google manual, which is located here: http://code.google.com/android/intro/installing.html#installingsdk


For your convenience we copied the relevant steps here:


-=-=-=-=-=-=-=- Extracted from Google manual -=-=-=-=-=-=-=-


Installing the SDK


After downloading the SDK, unpack the .zip archive to a suitable location on your machine. For the rest of this document, we will refer to the directory where you installed the SDK as $SDK_ROOT.


Optionally, you can add $SDK_ROOT/tools to your path:


  • On Linux, edit your ~/.bash_profile or ~/.bashrc file. Look for a line that sets the PATH environment variable and add the full path to your $SDK_ROOT/tools to it. If you don't see a line setting the path, you can add one:

    export PATH=${PATH}: <path to your $SDK_ROOT/tools>
  • On a Mac, look in your home directory for .bash_profile and proceed as for Linux. You can create the .bash_profile, if you haven't already set one up on your machine.
  • On Windows, right click on My Computer, and select Properties. Under the Advanced tab, hit the Environment Variables button, and in the dialog that comes up, double-click on Path under System Variables, and add the full path to the tools/ directory under $SDK_ROOT to it.

Adding $SDK_ROOT/tools to your path lets you run Android Debug Bridge (adb) and the other command line tools without needing to supply the full path to the tools directory. Note that, if you update your SDK, you should remember to update your PATH settings to point to the new location, if different.


-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-


Now navigate to the $SDK_ROOT/tools directory and execute the file 'emulator.exe'. This is the Android emulator itself. Wait couple of minutes until it loads. Now you must see the home screen of Android - wallpapers with snowy mountains on the background and the navigation bar below.

Enjoyed? Ok! Let's continue. Download and save locally a APK-file which you want to install/evaluate on the emulator. We recommend to save the APK file directly in the $SDK_ROOT/tools directory.

Note: APK probably stands for "Android package". It's an application distribution unit in the Android environment. If you are coming from the Windows Mobile world, think of APK as of CAB-files.

Ok, now start the console ("Start -> Run... -> type 'cmd'" for Windows computers). Type-in the following command: adb install $APK where $APK is the name of the APK file. For example: adb install Snake.apk

If you receive a "path not found" error, then you probably either didn't add path to the $SDK_ROOT/tools directory to your system PATH settings or the application you are trying to install is not in the $SDK_ROOT/tools directory.


If all went without errors then you should be seeing your newly installed APK on the emulator.

Enjoy Android!

46 comments:

  1. Now you can just use YouWave Android software to do all the above through just a few clicks. It is cool software with better performance. Check out youwave.com site.
    ReplyDelete
  2. Thanks for this guide. I'm using Eclipse and can test an applicaton on an emulator with no problem. a Compile generate an APK file.. I can also export and sign the solution with a keystore. Not clear on how to deploy the solution to my Android phone though. Thanks.
    ReplyDelete
  3. I dont understand how to install SDK
    ReplyDelete
  4. You just unpack the SDK, and in this article, change $SDK_ROOT to the location of where you unpacked it.
    ReplyDelete
  5. thanks for explaining APK file similar to CAB file... now i totally get the APK file purpose....
    ReplyDelete
  6. hey .. how to install .apk file in emulator on linux platform.. on windows I ve installed it.. but cant in linux
    ReplyDelete
  7. thanks for the guide! it helped me to work things out.
    ReplyDelete
  8. When i type adb install (game name.apk)it says that adb is not recognized internal command
    ReplyDelete
  9. How can i install apps in google andriod emulator 1.5?

    pls help!

    mfg anonymus^^
    ReplyDelete
  10. To install in Linux, go to your sdk folder, to platform-tools.
    In my case "/bin/android-sdk-linux_86/platform-tools>" open terminal in this folder and type: ./adb install Snake.apk

    thats all, works for me
    ReplyDelete
  11. Thank you Zeldan, it really worked.

    I got some error messages at first place:

    * daemon not running. starting it now on port 5037 *
    * daemon started successfully *
    error: device offline

    But, I re-ran the command, and it gave me the success sign! Hooray! Thanks again.
    ReplyDelete
  12. If you get "adb is not recognized internal command" then try finding it inside platform-tools folder instead of the tools folder in the sdk location
    ReplyDelete
  13. Hi all

    I want to run live video streaming on Android emulator. But android does not support .swf file.

    Please suggest what i do?

    Thanks
    awinash kumar
    ReplyDelete
  14. On my mac, it works! But i can't install the aloqa.apk , all other apps work, but aloqa.apk always causes an error like FAILURE - NOT SHARED LIBARY! Does anybody know why? I have also intalled de Google API!
    ReplyDelete
  15. I have the SDK installed and I added the path to my $SDK_ROOT (C:\etc...\tools) but when i type adb in the cmd prompt it just says it's not recognized. I can use eclipse fine and all that so the SDK is installed properly it's just through the cmd line it won't work. I am trying to install VoiceSearch.apk but have no clue how.
    ReplyDelete
  16. I don't understand the whole "change path to my $SDK_ROOT" any help with advice that is understandable?
    ReplyDelete
  17. So, Start, Run, CMD, then type the command "adb Install (Location)" Right? I do it, and keep getting this error message.

    'adb' is not recognized as an internal or external command,
    operable program or batch file.

    Am I Doing this wrong? please help...

    C:\Documents and Settings\Tom>
    ReplyDelete
  18. So, if I need to leave my PATH intact for something else, can I just script a batch file with the path in it and just overwrite the package name as necessary? If I save the .apk in the same folder that adb.exe is in (currently "~\platform-tools\") and script:

    c:
    cd "C:\Program Files\Android\android-sdk\platform-tools"
    adb
    adb install PACKAGE.apk

    Just substitute for PACKAGE and double-click on the batch file, right?
    If so, do I need "adb" on there twice?
    I just used an ffmpeg batch file as a template when I was transcoding a video file and I've been doing it that way ever since. A week, really.
    ReplyDelete
  19. I get Install failure---MISSING SHARED LIBRARY...
    ReplyDelete
  20. Message: Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]
    ReplyDelete
  21. I could get to open emulator and install application, but the emulater screen is larger than my screen and I'm not able to click on bottom menu. I've already tried moving it and change screen resolution but did't work.
    ReplyDelete
  22. how to find the installed apk files in emulator?i cannot find the app..
    ReplyDelete
  23. Command prompt pops up for a brief second when I double click the emulator.exe and then nothing else happens. I get no screen with anything that says android on it and I installed java and all the stuff that the program wanted me to but when I try to run the emulator nothing happens. :(
    ReplyDelete
  24. i got an error... i.e.
    'adb' is not recognized as an internal or external command, operable program or batch file.
    ReplyDelete
  25. I tried this but my windows dont know adb comment.
    the error in adb comment it said; unknow comment. So I didn't install apk files. please if you know what is mean? you can teach me.thanks a lot.
    ReplyDelete
  26. mr.haps, I agree with you. I've got same error. but I dont know what I have to do.
    ReplyDelete
  27. i found adb in the android-sdk\platform-tools\adb.exe i run it... nothing happend... then i went back and typed the "adb install .apk" still same error "'adb' is not recognized as an internal or external command, operable program or batch file"... Help... i changed the location on the .apk files first attempt in 'tools' second in 'platform-tools
    ReplyDelete
  28. goto ->plattform-tools(copy the sample.apk file her)
    then
    ->adb install sample.apk(it works very well)
    ReplyDelete
  29. ex:
    d:>AnroidDemo\android_sdk_windows\platform-tools>(here we have to copy the .apk file)
    then in the same directory in the cmd promt
    d:>AnroidDemo\android_sdk_windows\platform-tools>adb install sample.apk(it will install in emulator immediately)
    ReplyDelete
  30. After I type in adb install FishGame.apk
    I get a message say:
    231 KB/s (20388717 bytes in 86.000s)
    pkg: /data/local/tmp/FishGame.apk
    Failure [INSTALL_FAILED_INSUFFICIENT_STORAGE]
    ReplyDelete
  31. The adb tool has moved to platform-tools/

    If you don't see this directory in your SDK,
    launch the SDK and AVD Manager (execute the android tool)
    and install "Android SDK Platform-tools"

    Please also update your PATH environment variable to
    include the platform-tools/ directory, so you can
    execute adb from any location.
    ReplyDelete
  32. Computer lovers who would like to pst their profile can see here

    oliveyou.net
    ReplyDelete
  33. works perfectly in ubuntu.
    Ensure you check that the .jar file is set as executable (found in the permissions tab). Launch the executable by right clicking the file and open it with a Sun JRE.

    Paste the .apk in the platform-tools folder where the adb is.

    Launch the emulator in eclipse.

    In terminal go to the platform tools folder where you pasted the .apk.

    Type
    ./adb install SensorSimulatorSettings-2.0-rc1.apk

    The APK is installed. Use the above directions for manipulating the phone and seeing results in the emnulator. Good Luck!
    ReplyDelete
  34. sir,i m understanding how to install apk in emulator plz suggest there is a error adb not recognized and i need it urgently i wanna 2 make vedio of my project i hav viva plz suggest me
    ReplyDelete
  35. Worked! Thanks - you are awesome!
    ReplyDelete
  36. i tried as the above but i got the error as follows:
    'adb' is not recognized as an internal or external command,
    operable program or batch file.

    please help me.
    ReplyDelete
  37. Hi,

    I am getting this error.
    386 KB/s (1109117 bytes in 2.801s)
    Error: Could not access the Package Manager. Is the system running?

    Please guide me to fix it.
    ReplyDelete
  38. Thank youuuuuuuuuuuuuuuu!!!!
    ReplyDelete
  39. Thanks for the tutorial, its useful for me..
    ReplyDelete
  40. This is one of the good quality post.Your blog information is very specific.This is one of the useful post.
    Android app developers
    ReplyDelete
  41. when install root.apk file then give error
    EOCD not found,not zip
    file 'root.apk' is not a valid zip file
    how remove this problem
    please help me immediately
    ReplyDelete
  42. I get the error "We got a problem Huston" and nothing happens after I say fake the provider or if I say restore setting.
    ReplyDelete
  43. once install apk. files (to my next2 tablet), does this allow me to stream youtube videos. please help...
    ReplyDelete