How to install an APK file on an Android phone?

Android

Android Problem Overview


I have a simple "Hello Android" application on my computer (Eclipse environment), and I have built an APK file. How do I transfer the APK file to my Android phone for testing?

My phone is Ideos running Android 2.2 (Froyo). My laptop has Windows Vista. I have the latest Android SDK installed.

Android Solutions


Solution 1 - Android

Simply, you use ADB, as follows:

adb install <path to apk>

Also see the section Installing an Application in Android Debug Bridge.

Solution 2 - Android

If you have access to a Gmail account on the phone then an easy way (in terms of minimal set up effort) is to mail the .apk file to that Gmail account.

If you then access that account from the native Gmail app on the phone it recognises that the attachment is an app and offers an "Install" button.

As per other responses this approach also requires that you have selected USB debugging on the device.

Try this - it is remarkably easy ;-)

Solution 3 - Android

I quote Hello Android because I can't say it better ;-)

> You need to enable USB debugging on the phone itself (by starting the Settings application and selecting Applications > Development > USB Debugging), install the Android USB device driver if you haven’t already (Windows only), and then plug the phone into your computer using the USB cable that came with the phone. > > Close the emulator window if it’s already open. As long as the phone is plugged in, Eclipse will load and run applications on the phone instead. You need to right-click the project and select Run As > Android Application.

Solution 4 - Android

If you dont have SDK or you are setting up 3rd party app here is another way:

  1. Copy the .APK file to your device.
  2. Use file manager to locate the file.
  3. Then click on it.
  4. Android App installer should be one of the options in pop-up.
  5. Select it and it installs.

Solution 5 - Android

outside device,we can use :

adb install file.apk

or adb install -r file.apk

  adb install [-l] [-r] [-s] [--algo <algorithm name> --key <hex-encoded key> --iv <hex-encoded iv>] <file>
                               - push this package file to the device and install it
                                 ('-l' means forward-lock the app)
                                 ('-r' means reinstall the app, keeping its data)
                                 ('-s' means install on SD card instead of internal storage)
                                 ('--algo', '--key', and '--iv' mean the file is encrypted already)

inside devices also, we can use:

pm install file.apk

or pm install -r file.apk

pm install: installs a package to the system.  Options:
    -l: install the package with FORWARD_LOCK.
    -r: reinstall an exisiting app, keeping its data.
    -t: allow test .apks to be installed.
    -i: specify the installer package name.
    -s: install package on sdcard.
    -f: install package on internal flash.
    -d: allow version code downgrade.

For more then one apk file on Linux we can use xargs and on windows we can use for loop.
Linux / Unix sample :

ls -1 *.apk | xargs -I xxx adb install -r xxx

Solution 6 - Android

Put the APK file into the tools folder in the Android SDK and give the path to tools in the command prompt and use the command:

adb install "name".apk file

Solution 7 - Android

Directly connect your Android device and select the USB debugging option in the device. Eclipse will itself find your device, and then just run the code.

Or alternatively, paste your APK file in the Android SDK platform-tools folder and from the command prompt install it like this:

D:......../platform-tools> adb install yourfile.apk.

Solution 8 - Android

For debugging:

  • Enable USB debugging on your phone (settings -> applications -> development).
  • Connect your phone to the computer, and make sure you have the correct drivers installed.
  • In Eclipse, run your project as an Android application (right click project -> run as -> Android application).

Installing the APK file:

  • Export the APK file, make sure you sign it (right click project -> Android tools -> export signed application package).
  • Connect your phone, USB debugging enabled.
  • from the terminal, use ADB to install the APK file (adb install path-to-your-apk-file.apk).

Solution 9 - Android

I was using the command prompt to manually install the .apk file on my device (Nexus 7) but the following should work in theory on any android device (after enabling the device for developer mode). This method was becoming cumbersome so I created a simple batch file so now all I have to do is double-click it and it installs for me (device must be plugged in to my development machine). Just create a text file and save it as .BAT with the following text (customize to accommodate your file paths):

cd C:\{**path to your install location**}\sdk\platform-tools

adb install C:\{**path to your .apk file**}\{**project/apk file name**}.apk

Solution 10 - Android

For what its worth, installing a system app to the /system/app directory will be:

adb push appname.apk /system/app/

Just ensure you're in the right directory where the target .apk file to be installed is, or you could just copy the .apk file to the platform-tools directory of the Android SDK and adb would definitely find it.

Solution 11 - Android

If you have mutliple devices/emulators, the commands above may not work. So, try these steps

  1. get device list by running adb devices. this will list devices and their IDs
  2. install apk using adb -s [DEVICE-ID] [-r|-l] <apk path>

Ensure you unlock your device in the process.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiongathView Question on Stackoverflow
Solution 1 - AndroidPinkiView Answer on Stackoverflow
Solution 2 - AndroidairewyreView Answer on Stackoverflow
Solution 3 - AndroidLarsView Answer on Stackoverflow
Solution 4 - Androidmiket3View Answer on Stackoverflow
Solution 5 - AndroidShakiba MoshiriView Answer on Stackoverflow
Solution 6 - AndroidAnandView Answer on Stackoverflow
Solution 7 - AndroidN-JOYView Answer on Stackoverflow
Solution 8 - AndroidHolmView Answer on Stackoverflow
Solution 9 - AndroidHow 'bout a FrescaView Answer on Stackoverflow
Solution 10 - AndroidFeyisayo SonubiView Answer on Stackoverflow
Solution 11 - AndroidleeCoderView Answer on Stackoverflow