Install an APK File from Command Prompt

Install an apk file from command prompt?

You can use the code below to install application from command line

adb install example.apk

this apk is installed in the internal memory of current opened emulator.

adb install -s example.apk

this apk is installed in the sd-card of current opened emulator.

You can also install an apk to specific device in connected device list to the adb.

adb -s emulator-5554 install myapp.apk

Refer also to adb help for other options.

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

You can simply drag and drop the .apk file of your application to the emulator and it will automatically start installing.

Another option:


Windows:

  1. Execute the emulator (SDK Manager.exe->Tools->Manage AVDs...->New then Start)
  2. Start the console (Windows XP), Run -> type cmd, and move to the platform-tools folder of SDK directory.
  3. Paste the APK file in the 'android-sdk\tools' or 'platform-tools' folder.
  4. Then type the following command.

adb install [.apk path]

Example:

adb install C:\Users\Name\MyProject\build\Jorgesys.apk

Linux:

  1. Copy the apk file to platform-tools in the 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


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

Mac:

PATH=$PATH:~/Library/Android/sdk/platform-tools

Example : PATH=$PATH:/users/jorgesys/eclipse/android-sdk-mac_64/tools

Then run adb.

Mac:

1.Run the emulator,

2.then copy your .apk file and paste into /Users/your_system_username/Library/Android/sdk/platform-tools,

if you are not able to find sdk path in your mac system, do the following steps: Open finder->select Go option on top menu -> select Go to Folder option -> it will popup a window with a textfield: /Users/your_system_username/Library/Android/sdk/ -> now open platform-tools folder and paste your copied .apk file,


  1. Now open the terminal and type the following:
    cd Library/Android/sdk/platform-tools

  2. execute the following in your terminal: ./adb install yourapkfilename.apk if you get the following error message: error: no devices found - waiting for device, follow step 5.

  3. Run your emulator from Android Studio, once emulator active then repeat step 4, you will see the success message on your terminal.

I can't Install Apk from android app bundle using command prompt

As a precondition remember to create an environment variable "ANDROID_HOME" and set it to where the Android SDK is located on your Development machine.

So for Windows it may be

ANDROID_HOME = "C:/MyAndroid"

Assuming you are testing on just one device first generate the bundle only for your connected device using the following.

bundletool build-apks --connected-device  --bundle="\somepath\app-release.aab" --output="\somepath\release.apks" --ks="somepath\keystore" --ks-pass=pass:cleartextpasswd --ks-key-alias=keyalias --key-pass=pass:cleartextpasswd

Note the use of the option

--connected-device

Now to install on a specific device use the following command:

bundletool install-apks --apks="somefolder\release.apks"
--device-id="yourdeviceidstring"

Get the device id string from the Settings section of your device.

How to build .apk file from Windows command-line?

You can do it in command line (.bat) in windows using ant.

with:
"ant release"
You build the apk unsigned.

Then you need to add the call to "jarsigner" and "zipalign" in the bat to complete the task.

You can find an example of the command line to call these tools here:
http://developer.android.com/guide/publishing/app-signing.html#signapp

Best,

How to install multiple android applications ( from apk files) into device?

I found the solution. Its actually very simple:

adb install application1.apk & adb install application2.apk & adb install applicaiton3

That's what i was looking for.
Thanks everyone

Cannot install android apk to emulator from command prompt

adb.exe is not in your system's path, so cmd cannot find it.

It is located in \...\adt-bundle-windows-x86-20140624\sdk\platform-tools>, not in \...\adt-bundle-windows-x86_64-20140624\sdk\tools



Related Topics



Leave a reply



Submit