161

Possible Duplicate:
How do you install an APK file in the Android emulator?

I download an APK file and I want to run it on an Android emulator but I don't know how. Please help me. Thanks!

Utku
  • 2,025
  • 22
  • 42
mahdi
  • 16,257
  • 15
  • 52
  • 73
  • Best answer : http://stackoverflow.com/a/3480235/1318946 – Pratik Butani Mar 22 '13 at 06:36
  • 12
    Open your emulator....drag and drop the .apk file to your emulator...it worked for me!!! – Akhilesh Sinha Feb 24 '17 at 03:05
  • Great suggestion @AkhileshSinha. Drag and drop worked for me even on Microsoft's Android Emulator. It can't be any simpler than this :). I wonder why would anyone use any other method but drag and drop. – RBT Aug 17 '18 at 07:22
  • None of these answers or comments seem to say how to "run" the apk on the emulator. They all only talk about installing it, which is an entirely different thing. – Paul Lefebvre Apr 05 '19 at 14:07

4 Answers4

203

Steps (These apply for Linux. For other OS, visit here) -

  1. Copy the apk file to platform-tools in android-sdk linux folder.
  2. Open Terminal and navigate to platform-tools folder in android-sdk.
  3. Then Execute this command -

    ./adb install FileName.apk

  4. If the operation is successful (the result is displayed on the screen), then you will find your file in the launcher of your emulator.

For more info can check this link : android videos

Community
  • 1
  • 1
Bhushan
  • 2,054
  • 1
  • 13
  • 2
69

You need to install the APK on the emulator. You can do this with the adb command line tool that is included in the Android SDK.

adb -e install -r yourapp.apk

Once you've done that you should be able to run the app.

The -e and -r flags might not be necessary. They just specify that you are using an emulator (if you also have a device connected) and that you want to replace the app if it already exists.

Dan Dyer
  • 53,737
  • 19
  • 129
  • 165
  • i want to try in on emulator and not on device , so where i should copy apk file on pc ? – mahdi Dec 24 '10 at 20:07
  • @mahdi That command is for installing on the emulator. Start the emulator and run that command. It doesn't matter where the .apk file is stored, it will be copied to the emulator. – Dan Dyer Dec 24 '10 at 20:16
  • this message shown on command line "Permission denide" – mahdi Dec 24 '10 at 20:34
  • how can i be root user in android command line ? – mahdi Dec 24 '10 at 20:34
  • I don't know why you get that error. Perhaps it's a permissions problem with the emulator files? Did you install it as the same user that you are running the adb command with? – Dan Dyer Dec 24 '10 at 21:45
  • 27
    In addition to this answer, if you need to install it on a specific emulator, you can use: `adb -s emulator-5554 -e install -r yourapp.apk` where `emulator-5554` is the name of the emulator instance (it's in the titlebar after you run the emulator) – iwasrobbed May 10 '11 at 13:46
  • 3
    `adb -s emulator-5554 install yourapp.apk` also works – Mehul Joisar May 28 '14 at 05:40
  • +1 for including and explaining -e and -r flags. – Serdnad Jun 23 '14 at 21:54
  • Helpful as it seems like it should work, but a certificate error of some kind kept it from working for me. – Brian Knoblauch Sep 02 '14 at 20:03
  • @BrianKnoblauch Do you have the text of the error? It will refuse to replace an APK with one signed with a different certificate. If you want to do that you need to uninstall the old APK first. – Dan Dyer Sep 03 '14 at 13:40
  • New to Android development - what is the adb command? It's not recognized on windows, and I have little dev experience on a non-unix cmd line – jdero Jul 15 '15 at 16:32
  • 1
    @jdero It's the Android Debug Bridge (http://developer.android.com/tools/help/adb.html) tool. If you have installed the Android SDK I would expect it to be present on Windows but I'm not a Windows user (perhaps it's just not on your path?). – Dan Dyer Jul 15 '15 at 16:44
  • Yeah, that seems to be the case. Thanks for the ref. – jdero Jul 15 '15 at 16:44
  • Is it possible to install application in emulator using play store ? I can't find it in emulator. – ransh May 22 '16 at 18:51
22

Start an Android Emulator (make sure that all supported APIs are included when you created the emulator, we needed to have the Google APIs for instance).

Then simply email yourself a link to the .apk file, and download it directly in the emulator, and click the downloaded file to install it.

Nilloc
  • 845
  • 7
  • 20
  • 1
    Thanks. Your answer gave me an idea; i just put my apk file inside the phone and ran it. Worked like a charm. – irfandar Mar 31 '13 at 06:22
7

Step-by-Step way to do this:

  1. Install Android SDK
  2. Start the emulator by going to $SDK_root/emulator.exe
  3. Go to command prompt and go to the directory $SDK_root/platform-tools (or else add the path to windows environment)
  4. Type in the command adb install
  5. Bingo. Your app should be up and running on the emulator
Community
  • 1
  • 1
Anurag Jain
  • 79
  • 1
  • 1