123

How do you install an apk on the emulator in Android Studio from the terminal?

In Eclipse we did

/home/pcname/android-sdks/platform-tools/adb -s emulator-5554 install /home/pcname/Downloads/apkname.apk

Now how about in Android Studio?

Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393
stackoverflow
  • 2,320
  • 3
  • 17
  • 21
  • You do the same thing. The apks are in $project/$module/build/apk. You can ofcourse just run the application from the UI which will automatically install it. – Siva Velusamy Jun 18 '13 at 15:58
  • 3
    “To install an APK file on the emulated device, drag an APK file onto the emulator screen. An APK Installer dialog appears. When the installation completes, you can view the app in your apps list. To add a file to the emulated device, drag the file onto the emulator screen. The file is placed in the `/sdcard/Download/` directory.” ([Source](https://developer.android.com/studio/run/emulator)) This should have been possible since Android Studio 2.0, unless “Settings” → “General” → “Use detected ADB location” is configured wrongly. – caw Apr 17 '19 at 21:51

14 Answers14

276

Run simulator -> drag and drop yourApp.apk into simulator screen. Thats all. No commands.

user2511630
  • 3,214
  • 2
  • 17
  • 15
  • 1
    wow! amazing! even works in KDE. The adb answers here are all correct, but drag-n-drop should have more +1 – andrew lorien May 23 '16 at 02:37
  • 1
    Yes I develop apps in Android Studio. Someone using Eclipse can shed some light. Thanks. – user2511630 Jun 08 '16 at 23:43
  • 1
    If you get this error INSTALL_FAILED_UPDATE_INCOMPATIBLE - Uninstall an existing copy first - http://stackoverflow.com/questions/26794862/failure-install-failed-update-incompatible-even-if-app-appears-to-not-be-insta – mrwaim Oct 11 '16 at 03:21
  • It's always a good idea to delete existing app before installing new version for testing purpose at least. – user2511630 Oct 12 '16 at 13:18
  • 2
    didnt work in android studio 2.2.. i tried dropping to android emulator (nexus 5) – GorvGoyl Feb 13 '17 at 10:16
  • 4
    This doesn't work for me. When I drag the APK over the emulator, I get the "no entry" "computer says no" cursor. – Matt May 29 '19 at 03:20
131

EDIT: Even though this answer is marked as the correct answer (in 2013), currently, as answered by @user2511630 below, you can drag-n-drop apk files directly into the emulator to install them.


Original Answer:

You can install .apk files to emulator regardless of what you are using (Eclipse or Android Studio)

here's what I always do: (For full beginners)

1- Run the emulator, and wait until it's completely started.

2- Go to your sdk installation folder then go to platform-tools (you should see an executable called adb.exe)

3- create a new file and call it run.bat, edit the file with notepad and write CMD in it and save it.

4- copy your desired apk to the same folder

5- now open run.bat and write adb install "your_apk_file.apk"

6- wait until the installation is complete

7- voila your apk is installed to your emulator.

Note: to re-install the application if it already existe use adb install -r "your_apk_file.apk"

sorry for the detailed instruction as I said for full beginners

Hope this help.

Regards,

Tarek

Example 1

Example 2

Tarek K. Ajaj
  • 2,461
  • 1
  • 19
  • 24
  • 1
    Hi Tarek! I have followed your steps (thanks for detailing them for full beginners like me!). When I double click run.bat, I paste `adb install -r "myapp.apk"`, I get the same success message than you but nothing appear on my emulator. The emulator just stay as it is when I launch it via AVD manager in Android studio. Any idea why or what I am missing? – MagTun Mar 23 '15 at 08:32
  • any idea how to do this on linux? – roopunk Dec 02 '15 at 06:35
  • @roopunk try using the terminal to navigate to **platform-tools** in your **sdk** folder and continue from step **4**. if you encountered problems running the adb command try using ./adb instead like *Kim Stacks* mentioned in his answer – Tarek K. Ajaj Dec 02 '15 at 11:05
35

For those using Mac and you get a command not found error, what you need to do is

type

./adb install "yourapk.apk"

enter image description here

Kim Stacks
  • 10,202
  • 35
  • 151
  • 282
32

Start your Emulator from Android Studio Tools->Android-> AVD Manager then select an emulator image and start it.

After emulator is started just drag and drop the APK Very simple.

Abhijit Chakra
  • 3,201
  • 37
  • 66
15

Just drag APK file to android emulator it will install automatically.

Prashant Sharma
  • 1,357
  • 1
  • 21
  • 31
  • 1
    This doesn't work for me. When I drag the APK over the emulator, I get the "no entry" "computer says no" cursor. – Matt May 29 '19 at 03:21
11

In android studio emulator to run an apk file just drag the apk into the emulator.The emulator will install the apk

baswaraj
  • 629
  • 7
  • 7
  • This doesn't work for me. When I drag the APK over the emulator, I get the "no entry" "computer says no" cursor. – Matt May 29 '19 at 03:20
10

Much easier is just to start your emulator, then go to sdk/platform-tools and use adb from there to install apk. Like:

adb install xxx.apk

It will install it on running emulator.

Evgeniy Spinov
  • 101
  • 1
  • 5
6

Drag and drop apk if the emulator is launched from Android Studio. If the emulator is started from command line, drag and drop doesn't work, but @Tarek K. Ajaj instructions (above) work.

Note: Installed app won't automatically appear on the home screen, it is in the apps container - the dotted grid icon. It can be dragged from there to the home screen.

Mitch
  • 641
  • 1
  • 10
  • 13
5

enter image description here

When you start Android studio Look for Profile or Debug apk.

After clicking you get the option to browse for the saved apk and you will be able to later run it using emulator

If Android Studio is already open:

Click on File you can find Profile or Debug apk in this menu too

Meenohara
  • 314
  • 4
  • 9
2

For Linux: once emulator is running, the following worked for me.

Because I installed the Android SDK on my home directory, I have the following file structure:

  • home/Android/Sdk/platform-tools/adb

  • home/AndroidStudioProjects/Metronome.adk

AndroidStudioProjects is a file folder I made for my Android projects. "Metronome.adk" is the file I want to run.

So, using Terminal from the home directory...

./Android/Sdk/platform-tools/adb install ./AndroidStudioProjects/Metronome.adk

Being a Linux novice, I often forget the need to put the "./" in when trying to locate a file or run a command.

After the command achieves "Success", the app is in the Apps area of the emulator and can be run.

Phil Freihofner
  • 7,645
  • 1
  • 20
  • 41
1

Just download the apk from talkback website

Drag the downloaded apk to the started emulator, Go to settings on emulator > Search for talkback, you will now find it there

SUPARNA SOMAN
  • 2,311
  • 3
  • 19
  • 35
  • This doesn't work for me. When I drag the APK over the emulator, I get the "no entry" "computer says no" cursor. – Matt May 29 '19 at 03:21
0

1.Install Android studio. 2.Launch AVD Manager 3.Verify environment variable in set properly based on OS(.bash_profile in mac and environment Variable in windows) 4. launch emulator 5. verify via adb devices command. 6.use adb install apkFileName.apk

jayesh
  • 3,277
  • 1
  • 18
  • 7
0

Upload your apk file on the cloud , then make a direct download link for downloading and then copy that link and paste it on the emulator browser for download it :) ;

-1

In Android Studio: View - Tool Windows - Gradle

In the Gradle tool window navigate to your :app - Tasks - install and then execute (by double-clicking): any of your install*tasks: e.g. installDebug, installRelease

Note: the apk will also automatically installed when you Run your application

TmTron
  • 17,012
  • 10
  • 94
  • 142