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.
This question is related to
android
Simply, you use ADB, as follows:
adb install <path to apk>
Also see the section Installing an Application in Android Debug Bridge.
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
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
For debugging:
Installing the APK file:
adb install path-to-your-apk-file.apk
).If you dont have SDK or you are setting up 3rd party app here is another way:
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.
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.
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 ;-)
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
Source: Stackoverflow.com