adb install command is not working - android

I am trying to install apk via usb is not installing.
Device is detected perfectly .but apk is not installing.
Even i tried with the following command.
D:\Softwares\adt-bundle-windows-x86-20131030\sdk\platform-tools>adb install f:Fi
lth\Sample\bin\Sample.apk
4669 KB/s (277327 bytes in 0.058s)
D:\Softwares\adt-bundle-windows-x86-20131030\sdk\platform-tools>

First, check whether your device is connected or not. If connected, check there is only one device running i.e. mobile or emulator.
Copy your apk file and paste inside the platform-tools folder
D:\Softwares\adt-bundle-windows-x86-20131030\sdk\platform-tools>
now shift+right click on the platform-tools folder -> Open command window here
Then check whether your adb is running successfully or not.Try these command to restart adb
adb kill-server
adb start-server
now you got the message "daemon started successfully"
now just use
adb install Sample.apk
Check out the image if you still have any problem.

Related

Android ADB devices unauthorized

Configuration:
Windows 8.1
ADB version: 1.0.32
Smartphone: Oneplus One
Problem
I installed the Samsung drivers as it is said to do. When I run the ADB devices command, it said unauthorized.
Already tried:
I've done everything that'd been said on this post: https://stackoverflow.com/a/25546300/1848376
But the problem is that I don't get a prompt on the phone to tell me I must accept the connection.
When I run the command adb shell, here is the answer:
error: device unauthorized.
This adbd's $ADB_VENDOR_KEYS is not set; try 'adb kill-server' if that seems wrong.
Otherwise check for a confirmation dialog on your device.
I did "adb kill-server", but it didn't change anything. Why?
Try Revoke USB DEBUGGING Authorization.
Enable USB debugging again.
It worked.
Thankgod xda developers exist : http://forum.xda-developers.com/verizon-lg-g3/help/unable-to-access-adb-t2830087
Just had to delete adbkey file in C:Users/$Name/.android adbkey.pub was missing.
Restart after this and both files are there.
If this does not work :
- Try Revoke USB DEBUGGING Authorization.
- Enable USB debugging again.
In sequence:
adb kill-server
in your DEVICE SETUP, go to developer-options end disable usb-debugging
press REVOKE USB debugging authorizations, click OK
enable usb-debugging
adb start-server
I removed the following files from the ~/.android folder:
adbkey
adbkey.pub
I disabled and enabled ADB within device and now it works...
in Developer options,
Enable USB debugging.
Give a authorization.
(if there is no a Developer option menu, you have to click 3 times build number of Phone State menu to be developer. you can sse a developer option menu.)
Delete existing adbkeys
OR
Rename adbkeys
Best practise is to rename the keys because it provides backup.
cd ~/.Android
mv adbkey adbkey2
mv adbkey.pub adbkey.pub2
Next stop & start the server
cd ~/Android/Sdk/platform-tools
Locate the device
/Android/Sdk/platform-tools$ ./adb devices
/Android/Sdk/platform-tools$ ./adb kill-server
/Android/Sdk/platform-tools$ ./adb start-server
Then, stop the emulator Open AVD manager, click on the down arrow, then click on wipe data
Restart the emulator. Then everything works fine :)
This worked for me
1- Go to ~/.android/ and remove “adbkey”
2- Disconnect USB connection
3- adb kill-server
4- Revoke USB debugging authorizations (in developer option)
5- Reconnect the device to the Ma
6- adb devices
Try this uncheck the "verify apps via USB" in developer options and then turn on and off the "USB Debugging". It works with me.
Ensure that you have accepted the pressed the "ok" button when it is asking it is showing the fingerprint of the device after connecting through usb to your PC.
In Android studio, Run menu > Run shows OFFLINE ... for the connected device.
Below is the procedure followed to solve it:
(Read the below note first) Delete the ~/.android/adbkey (or, rename to ~/.android/adbkey2, this is even better incase you want it back for some reason)
Note: I happened to do this step, but it didn't solve the problem, after doing all the below steps it worked, so unsure if this step is required.
Run locate platform-tools/adb
Note: use the path that comes from here in below commands
Kill adb server:
sudo ~/Android/Sdk/platform-tools/adb kill-server
You will get a Allow accept.. message popup on your device. Accept it. This is important, which solves the problem.
Start adb server:
sudo ~/Android/Sdk/platform-tools/adb start-server
In Android studio, do Run menu > Run again
It will show something like Samsung ... (your phone manufacture name).
Also installs the apk on device correctly this time without error.
Hope that helps.
None of the methods listed on this page worked for me; specifically:
I had an issue where the Settings app would crash when selecting Revoke USB debugging authorizations
I was running LineageOS 14 x86_64
I was using ADB over network
The /data/misc/adb contained no adb_keys file
Removing my local ~/.android/adbkey did not help either
I had root access from the local terminal
I was not getting any confirmation dialog
adb: error: failed to get feature set: device unauthorized.
This adb server's $ADB_VENDOR_KEYS is not set
Try 'adb kill-server' if that seems wrong.
Otherwise check for a confirmation dialog on your device.
- waiting for device -
In the end, I found a very useful post here that suggested to manually put the contents of ~/.android/adbkey.pub inside the /data/misc/adb/adb_keys file.
They suggested one of these two methods:
From another working device, copy the adb_keys file into your computer:
# On the other Android device
cp /data/misc/adb/adb_keys /sdcard
# From your computer
adb pull /sdcard/adb_keys .
Then put the working adb_keys file into the problematic Android device's sdcard (using Web or MTP) named as adb_keys, then copy the file into the correct path:
# On the problematic device
cp /sdcard/adb_keys /data/misc/adb/adb_keys
The other method is to simply copy your machine's adbkey.pub from the ~/.android/ directory, and put it into the problematic Android device's sdcard (using Web or MTP) named as adb_keys, then copy the file into the correct path:
# On the problematic device
cp /sdcard/adbkey.pub /data/misc/adb/adb_keys
(Note: there's a similar answer on SO that goes into further details for this method.)
Since I was running a web server on my computer, and I had curl installed on Android, I su'ed from the terminal and ran the following on my Android device:
cd /data/misc/adb
curl 192.168.1.35:8080/adbkey.pub > adb_keys
Killed the adb daemon (using adb kill-server) and BAM! The adb shell worked fine, like it should have been from the beginning.
Hopefully, the method described here works for you as it did for me.
First Remove the adbkey and adbkey.pub from the .android directory in your Home directory.
Make .android directory in your home with 710 permissions: $ chmod 710 .android/ and ownership as: chown -R <user>:<user> .android/. Ex:
$ chmod 710 .android/
$ chown -R ashan:ashan .android/
Go to developer options in your mobile and tap option Revoke USB debugging authorizations
Turn off all USB Debugging and Developer Options in the device and disconnect the device from your machine.
Connect the device again and at first turn on the Developer Options. Then Turn on the USB debugging.
At this point in your mobile, you will get a prompt for asking permission from you. Note: you must check the checkbox always accept from this …. option and click ok.
Now in you machine, start the adb server: adb start-server.
Hopefully when you issue the command: adb devices now, you will see your device ready authorized.
I was hit by this problem, too. I'm using my custom build of AOSP on Nexus 5X. I've added a single line in build/core/main.mk:
diff --git a/core/main.mk b/core/main.mk
index a6f829ab6..555657539 100644
--- a/core/main.mk
+++ b/core/main.mk
## -362,6 +362,8 ## else # !enable_target_debugging
ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=0
endif # !enable_target_debugging
+ADDITIONAL_DEFAULT_PROPERTIES += ro.adb.secure=1
+
## eng ##
ifeq ($(TARGET_BUILD_VARIANT),eng)
Now adb shell works fine
Those materials are useful (Chinese articles): http://www.voidcn.com/blog/kc58236582/article/p-6335996.html, http://blog.csdn.net/fanmengke_im/article/details/28389439
Try deleting the adbkey file from C/.android folder
and then run the commands as
mentioned above i.e.
adb kill-server, adb start-server and adb devices
.
Your app is being detected as some harmful program.
Turn off "Verify apps over USB" option. It's in the same view as "USB debugging".
All you need is to authorize debug mode.
1. make sure your Device is connected to your PC.
2. Allow authorized for debug mode via Android-Studio by going to
Run -> Attach debugger to Android process
than you will see the pop up window for allow debug mode in your Device, press OK. done.
i hope it help to someone.
I had the same problem after reinstalled my android studio. Here's what I did to make my adb work again:
-path to C:\Users\User\AppData\Local\Android\sdk\platform-tools
-Shift+r.click and start command from here instead.
for anyone encountering this later this may also help. I encountered this exact issue trying to use adb from a user command prompt and the answers above did not help, but the problem went away with an "adb kill-server" when running in an administrator command prompt.
This worked for me:
rm ~/.android/adbkey.pub
sudo ./adb kill-server
sudo ./adb start-server
sudo ./adb -s emulator-5554 install ~/apk_to_install.apk
I'm not sure if is a good idea run adb with sudo privileges,but it was the only way I get it works. Regards.
I got this as root when as a non-root user I was getting permissions errors trying to connect to custom recovery (Philz). so I killed adb server, copied the .android subdirectory of my user account into /root, chowned -R to root.root, and restarted adb server. I'm in!
Disconnect USB between PC and device
Stop adb server by entering "adb kill-server" in command window
On device use "Revoke USB debugging authorizations" in "Developer Options"
On PC delete "adbkey" file in user directory, for example "C:\Users\Amit\.android"
Reconnect the device to the PC
Open a command window and enter "adb devices". Watch the device's screen for any Authorization message and allow the connection.
I suppose you have enabled On-device Developer Options in your smartphone? If not you can take a look at the steps provided by Android, http://developer.android.com/tools/device.html#developer-device-options
For FIRE STICK 4K it actually says in the dialog:
Otherwise check for a confirmation dialog on your device
Indeed on the TV in the other room there was a confirmation dialog. Doh'!
I had this problem and it wasnt solved by the deleting of any keys (at least deleting them didnt fix it, maybe had an effect after i did fix it though)
I actually had a discrepancy between my sdk-tools version and my Android Studio version. After updating my tools it still didnt work, but after updating AS (to 1.4) everything worked fine again.
Always update both sdk-tools and AS version together ;)

Android "adb install" does nothing

I'm having trouble installing a simple .apk file using adb. Here's what I entered and got back:
adb install test.apk
4445 KB/s (1921193 bytes in 0.422s)
In an attempt to debug I added the trace flag and got back:
adb install test.apk ADB_TRACE=1
4445 KB/s (1921193 bytes in 0.422s)
Aborted
Also, the adb devices command does list my device and when I manually copy the .apk to my device it installs/runs fine.
Help :(
Try below
adb install -r test.apk
or you need to enable to insatll unknown source app in android settings.
Not really sure what was going on, but after a system update it now works just fine.

Unable to debug application over USB; works with emulator

Android Studio on Windows - Following successful Gradle sync and build, I am unable to launch my application on my (rooted) Android Galaxy S3 and debug via USB. I have USB Debugging enabled on my device.
I am able to:
provision and debug via the debug interface on the emulator
see my USB device in the Android DDMS window:
manually provision via adb, then connect via the debugger, using the same commands that come out of the debug window in Android Studio:
Cd "C:\Program Files (x86)\Android\android-studio\sdk\platform-tools"
adb -d shell
su
pm uninstall com.company.myapplication
ls -all /data/app | grep myapplication
pm install -r "/data/local/tmp/com.company.myapplication"
am start -n "com.company.myapplication/com.company.myapplication.MapsActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Following manual provisioning (see above), I can attach to the running process on my device, and debug (including hitting breakpoints):
Select my device from the "Choose Device" window when attempting to initiate USB debugging:
... following which I get the following output (and no activity on the Android device UI):
Waiting for device.
Target device: samsung-sgh_t999-6XXXXXX2
Uploading file
local path: D:\Data\XXXXXX\Sandpit\XXXXXX\MyApplication\app\build\outputs\apk\app-debug.apk
remote path: /data/local/tmp/com.company.myapplication
Installing com.company.myapplication
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.company.myapplication"`
Launching application: com.company.myapplication/com.company.myapplication.MapsActivity.
DEVICE SHELL COMMAND: am start -D -n "com.company.myapplication/com.company.myapplication.MapsActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Waiting for process: com.company.myapplication
In the case above, after checking files using the adb shell, I have noticed that the pm install command works -- i.e. there's an updated file (based on timestamp) in location /data/local/tmp/com.company.myapplication. However, the am start doesn't work, as the .apk file under
I have tried:-
Restarting the computer
Restarting the Android device
Reinstalling Android Studio
Run app (rather than Debug app): same result, no app installation on Android device
Creating a new test application to see whether it's a problem with Gradle or Manifest configuration problems in my original application.
Cleaning the project
Connecting as both a Media device (MTP), and also as Camera (PTP)
Enabling mock locations (Settings -> Developer options -> Allow mock locations)
Adding android:debuggable="true" to the Android Manifest XML (<appRoot>\MyApplication\app\src\main\AndroidManifest.xml), despite IDE suggestion to the contrary:
Ensuring ADB Integration is enabled:
Toggling the ADB connection on the phone (Settings -> Developer Options -> USB Debugging check/uncheck/recheck, reconnect)
Updating to the latest Samsung drivers for the S3 - downloaded, refreshed in Windows Device Manager:
Restarting the ADB Server, including as root, then re-connecting (and subsequently re-attempting debugging from Android Studio over USB):
C:\Program Files (x86)\Android\android-studio\sdk\platform-tools>adb wait-for-device
C:\Program Files (x86)\Android\android-studio\sdk\platform-tools>adb devices
List of devices attached
6XXXXXX2 device
C:\Program Files (x86)\Android\android-studio\sdk\platform-tools>adb root
C:\Program Files (x86)\Android\android-studio\sdk\platform-tools>adb kill-server
C:\Program Files (x86)\Android\android-studio\sdk\platform-tools>adb start-server
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
C:\Program Files (x86)\Android\android-studio\sdk\platform-tools>adb wait-for-device
C:\Program Files (x86)\Android\android-studio\sdk\platform-tools>adb devices
List of devices attached
6XXXXXX2 device
C:\Program Files (x86)\Android\android-studio\sdk\platform-tools>
Versions:-
I had Android Studio v0.8.2, but as part of my testing efforts have since downgraded to 0.8.1, which also doesn't work (same problem).
Cell phone is SGH-T999, Android version 4.1.2
OS is Windows 7 Enterprise SP1
What have I omitted? What else should I try?
Maybe installing the Universal ADB Driver will help. (Download)
Just to provide closure... I ended up dropping this device, and it wasn't worth repairing the screen, so this device no longer exists. My new device - also an S3 - works after being rooted.

Cannot install package on rooted device : INSTALL_FAILED_INVALID_URI

This is what I see when I try to install my app on my device (I'm using Android Studio 0.8.2):
Waiting for device.
Target device: samsung-gt_s7500-cf994b04
Uploading file
local path: C:\Users\Administrator\AndroidStudioProjects\Testaqua\app\build\outputs\apk\app-debug.apk
remote path: /data/local/tmp/com.example.administrator.testaqua
Installing com.example.administrator.testaqua
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.example.administrator.testaqua"
pkg: /data/local/tmp/com.example.administrator.testaqua
Failure [INSTALL_FAILED_INVALID_URI]
What in the seven hells does this error mean?
[Edited] I installed my app on another rooted device, and it worked; it seems the problem is my device, android studio is running fine.
I get similar error message, I fixed it by passing the absolute path instead of filename, e.g. inside adb shell, this command will shows:
shell#example:/sdcard $ pm install -r -d app-release.apk
pkg: app-release.apk
Failure [INSTALL_FAILED_INVALID_URI]
Change it to absolute path fixed that error message, e.g.:
pm install -r -d /sdcard/app-release.apk
[Second reason]
Another reason is the file not exist. It happen when I interrupt adb push <apk> /sdcard/ by Ctrl+C recently. Re-push apk twice required.
[Third reason]
This error occurred if the apk reside /mnt/runtime/default/<thumb_drive_mounted_directory>, I have to move the apk to /sdcard/ first to install.
From this blog try this :
Change permission of /data/local to rwxrwxrwx (normally it must be rwxrwxrw-)
i.e. grant execution privileges to all users.
symptoms: `
$ adb install xyz.apk
[100%] /data/local/tmp/xyz.apk
pkg: cat
ver: /data/local/tmp/xyz.apk
Failure [INSTALL_FAILED_INVALID_URI]
solution:
check if u have allow installation from unknown sources enabled :)
Finally, I found the reason is dir and file permission.
Android seems to use another user to access the dir and file.
chmod 775 /data/local/tmp/somedir ==> rwxrwx<b>r-x</b><br>
chmod 774 /data/local/tmp/somedir/a.apk ==> rwxrwx<b>r</b>--<br>
The above setting will be OK!
It happened with my Flutter app once. Removing apk file from your-project-name\build\app\outputs\apk\debug and running the app again solved the issue. Before this issue happened, I closed running Flutter app manually from the phone while it was still attached to terminal and running.

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

I finally managed to obfuscate my Android application, now I want to test it by installing the APK file and running it on the emulator.
How can I install an APK file on 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:
Execute the emulator (SDK Manager.exe->Tools->Manage AVDs...->New then Start)
Start the console (Windows XP), Run -> type cmd, and move to the platform-tools folder of SDK directory.
Paste the APK file in the 'android-sdk\tools' or 'platform-tools' folder.
Then type the following command.
adb install [.apk path]
Example:
adb install C:\Users\Name\MyProject\build\Jorgesys.apk
Linux:
Copy the apk file to platform-tools in the android-sdk linux folder.
Open Terminal and navigate to platform-tools folder in android-sdk.
Then Execute this command -
./adb install FileName.apk
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,
Now open the terminal and type the following:
cd Library/Android/sdk/platform-tools
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.
Run your emulator from Android Studio, once emulator active then repeat step 4, you will see the success message on your terminal.
If you've created more than one emulators or if you have an Android device plugged in, adb will complain with
error: more than one device and emulator
adb help is not extremely clear on what to do:
-d - directs command to the only connected USB device...
-e - directs command to the only running emulator...
-s <serial number> ...
-p <product name or path> ...
The flag you decide to use has to come before the actual adb command:
adb -e install path/to/app.apk
Nowadays, you can simply drag and drop the Android apk to the emulator and it will automatically starts installing.
go to sdk folder, then go to tools.
copy your apk file inside the tool directory
./emulator -avd myEmulator
to run the emulator on mac
./adb install myApp.apk
to install app on the emulator
go to the android-sdk/tools directory in command prompt and then type
adb install fileName.apk (Windows)
./adb install fileName.apk (Linux or Mac)
Copy .apk file in your SDK's platform-tools/ directory,then install the .apk on the emulator by using cmd(on windows):
adb install <path_to_your_bin>.apk
or
./adb install <path_to_your_bin>.apk
If there is more than one emulator running,
you can find all running emulators by this command:
adb devices
or
./adb devices
then you must specify the emulator upon which to install the application, by its serial number, with the -s option. For example:
adb -s emulator-5554 install path/to/your/app.apk
or
./adb -s emulator-5554 install path/to/your/app.apk
First you need to install Android Studio on your machine. Then simply follow these steps.
Go to you navigation bar and open Android Studio.
From the toolbar open AVD Manager. (If you cannot see it create a new android project)
Create a Virtual Device.
Select a hardware device that you want to install your app.
Select an android image that you want to install on your device. (If you cannot see any images you can download the require image from Recommended, x86 Images or Other images)
Add a name to your AVD.
Now the virtual device has been created and you can simply run it by clicking the play button.
Now you have setup the virtual device and now you need to install the APK file.
Download the APK file that you want to install and Drag and Drop it to the emulator.
The APK file has been successfully installed and you can see it in your applications.
Now you can simply run the installed app.
Drag and drop
Simply drag-and-drop the apk file into your emulator.
You can also run your android emulator without Android Studio.
In Genymotion just drag and drop the *.apk file in to the emulator and it will automatically installs and runs.
http://www.genymotion.com/
Download the Apk file from net and copy it to platform-tools of your SDK folder, then in command prompt go to that directory an type:
adb install filename.apk
press enter it will install in few seconds
Download apk file from browser and then just click on it (notification area). Installation will start automatically.
Goto Shell/Terminal/, reach at android-sdk/tools directory then
adb install fileName.apk // (u can run this command on windows)
or
./adb install fileName.apk //( u can run this command on linux)
Let's suppose you have to install Facebook APK on your emulator.
You can use adb to install the APK to the running emulator in OS X like this:
./adb install ~/FBAndroid-2.1.apk
And on Windows, like this:
adb install %HOMEPATH%\FBAndroid-2.1.apk
Once complete, check the apps screen of the emulator to check that the app has been installed correctly. If you need to force the upgrade of this app from a previous version, add the -r flag, like this on OS X:
./adb install -r ~/FBAndroid-2.1.apk
keep your emulator up and running.
In the command line, go inside the platform-tools folder, in your sdk folder which come with adt bundle and execute following command :
>adb install <yourFilename.apk>
This command detect your running emulator/emulators and show you the list of devices where you can install this app(show if any physical device/devices connected to your computer.). Then you can select any one, if only one emulator is running then app will directly installed on it by default.
Note: For above command your .apk file needs to be in same directory.
for more detailed tutorial follo : This link
From Windows 7 Onwards ,
Shift + Right click in your apk file folder.
Select Open Command Window Here
Type & Hit "adb install AppName.apk"
Drag and drop ".apk" file into the emulator window.
Just drag and drop your apk to emulator
(TESTED ON MACOS)
The first step is to run the emulator
emulator -avd < avd_name>
then use adb to install the .apk
adb install < path to .apk file>
If adb throws error like APK already exists or something alike. Run the adb shell while emulator is running
adb shell
cd data/app
adb uninstall < apk file without using .apk>
If adb and emulator are commands not found do following
export PATH=$PATH://android-sdk-macosx/platform-tools://android-sdk-macosx/android-sdk-macosx/tools:
For future use put the above line at the end of .bash_profile
vi ~/.bash_profile
if use more than one emulator at firs use this command
adb devices
and then chose amulatur and install application
adb -s "EMULATOR NAME" install "FILE PATH"
adb -s emulator-5556 install C:\Users\criss\youwave\WhatsApp.apk
I might be wrong, but on Windows I simply drag and drop the .apk into Android Emulator. I mean, doing all mentioned above seems to be a lot of work.
go to ADT/Android-sdk/tools directory in command prompt
1. adb install fileName.apk (Windows)
./adb install fileName.apk (Ubuntu/Linux or Mac)
06-11-2020
Drag and Drop didn't work for me on Windows 10 Pro.
Put the APK on Google Drive
Access that Google drive using Chrome browser on the Android Emulator
Then install it from there.
Note: You need to enable unknown sources within the Emulator.
Best way is to create a app, which opens the apk file on the emulator. You have to copy the .apk file to the download folder of your emulator. Then replace yourAppName.apk with your .apk name.
here is the code
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(Environment.getExternalStorageDirectory() + "/download/" + "yourAppName.apk")), "application/vnd.android.package-archive");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
}
(1) You can also use gradle commands to install your APK while choosing the product and flavor (Debug or Release).
See this Guide.
./gradlew assembleDebug (Incase you don't have the APK generated)
./gradlew installDebug
Incase you want a fresh install, you can remove any earlier installed builds on the device with below commands
./gradlew uninstallDebug
./gradlew installDebug
(2) You can also use the adb commands directly:
Setup adb for command line
export PATH=/Users/mayurik/Library/Android/sdk/platform-tools/adb:/Users/mayurik/Library/Android/sdk/tool
Command line ADB install
adb -d install pathto/sample.apk (on device)
adb -e install pathto/sample.apk (on emulator)
Also check the documentation here
$ adb devices
List of devices attached
emulator-5554 device
emulator-5555 device
$ adb -s emulator-5555 install helloWorld.apk
you write the command on terminal/cmd
adb install FileName.apk.
Now you can just drag and drop the apk in emulator and it will install!
On Linux I do this:
first see which devices I currently have: emulator -list-avds
build the release cd android && ./gradlew assembleRelease
install it at the emulated device "Nexus5" (you are inside the android directory, else use the full path to apk): adb -s '8e138a9c' install app/build/outputs/apk/app-release.apk
Thats it. You can also use ./gradlew installRelease
Follow the steps :
make sure you have allowed installation from unknown sources in
settings.
Use the Android Device Monitor to copy the APK to the sdcard.
Use the builtin browser in Android to navigate to
file:///sdcard/apk-name.apk
When the notification "Download complete" appears, click it.
1) paste the myapp.apk in platform-tools folder , in my case C:\Users\mazbizxam\AppData\Local\Android\android-sdk\platform-tools, this is the link in my case it may change to you people
2)open the directory in CMD CD C:\Users\mazbizxam\AppData\Local\Android\android-sdk\platform-tools
3)Now you are in platform-tools folder , just type adb install myapp.apk
please ensure that your emulator is turn on , if every thing is ok apk will install
Start the console (Windows XP), Run -> type cmd, and move to the
platform-tools folder of SDK directory.
In case anyone wondering how to run cmd in platform-tools folder of SDK directory, if you are running a new enough version of Windows, follow the steps:
Go to platform-tools through Windows Explorer.
While holding shift right click and you will find the option "Open Command window here".
Click on it and cmd will start in that folder.
Hope it helps

Categories

Resources