Difference between revisions of "IoTGateway/BSP/Android/Gettingstarted/ADB for install APK"

From ESS-WIKI
Jump to: navigation, search
Line 9: Line 9:
 
Start the SDK Manager EXE and deselect everything except “Android SDK Platform-tools”. If you are using a Nexus phone, you may also want to select “Google USB Driver” to download Google’s drivers. Click the Install button. This downloads and installs the platform-tools package, which contains ADB and other utilities.
 
Start the SDK Manager EXE and deselect everything except “Android SDK Platform-tools”. If you are using a Nexus phone, you may also want to select “Google USB Driver” to download Google’s drivers. Click the Install button. This downloads and installs the platform-tools package, which contains ADB and other utilities.
  
[http://www.howtogeek.com/wp-content/uploads/2012/10/643x421ximage30.png.pagespeed.gp+jp+jw+pj+js+rj+rp+rw+ri+cp+md.ic.Z4YP-OBlTR.png http://www.howtogeek.com/wp-content/uploads/2012/10/643x421ximage30.png.pagespeed.gp+jp+jw+pj+js+rj+rp+rw+ri+cp+md.ic.Z4YP-OBlTR.png]
+
[[File:Android sdk manager.png]]  
  
 
When it’s finished, you can close the SDK manager.
 
When it’s finished, you can close the SDK manager.
  
 
=== Step Two: Enable USB Debugging on Your Phone ===
 
=== Step Two: Enable USB Debugging on Your Phone ===
 +
 +
[[File:Usb debugging1.jpg]]
  
 
To use ADB with your Android device, you must enable a feature called USB debugging. Open your phone’s app drawer, tap the Settings icon, and select “About Phone”. Scroll all the way down and tap the “Build Number” item seven times. You should get a message saying you are now a developer.
 
To use ADB with your Android device, you must enable a feature called USB debugging. Open your phone’s app drawer, tap the Settings icon, and select “About Phone”. Scroll all the way down and tap the “Build Number” item seven times. You should get a message saying you are now a developer.
Line 25: Line 27:
 
Open the folder that you installed the SDK tools in and open the platform-tools folder. This is where the ADB program is stored. Hold Shift and right-click inside the folder. Choose “Open Command Window Here”.
 
Open the folder that you installed the SDK tools in and open the platform-tools folder. This is where the ADB program is stored. Hold Shift and right-click inside the folder. Choose “Open Command Window Here”.
  
[http://www.howtogeek.com/wp-content/uploads/2012/10/650x514ximage33.png.pagespeed.gp+jp+jw+pj+js+rj+rp+rw+ri+cp+md.ic.PjIC7dYXmy.png http://www.howtogeek.com/wp-content/uploads/2012/10/650x514ximage33.png.pagespeed.gp+jp+jw+pj+js+rj+rp+rw+ri+cp+md.ic.PjIC7dYXmy.png]
+
[[File:Platform tools.png]]
  
 
To test whether ADB is working properly, connect your Android device to your computer using a USB cable and run the following command:
 
To test whether ADB is working properly, connect your Android device to your computer using a USB cable and run the following command:
 
<pre>adb devices</pre>
 
<pre>adb devices</pre>
  
[http://www.howtogeek.com/wp-content/uploads/2012/10/650x134ximage34.png.pagespeed.gp+jp+jw+pj+js+rj+rp+rw+ri+cp+md.ic.67N2usSoGB.png http://www.howtogeek.com/wp-content/uploads/2012/10/650x134ximage34.png.pagespeed.gp+jp+jw+pj+js+rj+rp+rw+ri+cp+md.ic.67N2usSoGB.png]
+
[[File:Platform tools cmd.png]]
  
 
You should see a device in the list. If your device is connected but nothing appears in the list, you’ll need to install the appropriate drivers.
 
You should see a device in the list. If your device is connected but nothing appears in the list, you’ll need to install the appropriate drivers.
Line 38: Line 40:
 
You can also try installing the Google USB Driver from the Extras folder in the SDK Manager window, as we mentioned in the first step. This&nbsp;will work with some phones including Nexus devices.
 
You can also try installing the Google USB Driver from the Extras folder in the SDK Manager window, as we mentioned in the first step. This&nbsp;will work with some phones including Nexus devices.
  
[http://www.howtogeek.com/wp-content/uploads/2012/10/643x540ximage35.png.pagespeed.gp+jp+jw+pj+js+rj+rp+rw+ri+cp+md.ic.Mac26d1-_L.png http://www.howtogeek.com/wp-content/uploads/2012/10/643x540ximage35.png.pagespeed.gp+jp+jw+pj+js+rj+rp+rw+ri+cp+md.ic.Mac26d1-_L.png]
+
[[File:Android sdk manager2.png]]
  
 
If you use Google’s USB driver, you&nbsp;may have to force Windows to use the installed drivers for your device. Open the Device Manager (click Start, type Device Manager, and press Enter), locate your device, right-click it and select Properties. You may see a yellow exclamation mark next to the device if its driver isn’t installed properly.
 
If you use Google’s USB driver, you&nbsp;may have to force Windows to use the installed drivers for your device. Open the Device Manager (click Start, type Device Manager, and press Enter), locate your device, right-click it and select Properties. You may see a yellow exclamation mark next to the device if its driver isn’t installed properly.
  
[http://www.howtogeek.com/wp-content/uploads/2012/10/490x601ximage36.png.pagespeed.gp+jp+jw+pj+js+rj+rp+rw+ri+cp+md.ic.bOPUQTldLq.png http://www.howtogeek.com/wp-content/uploads/2012/10/490x601ximage36.png.pagespeed.gp+jp+jw+pj+js+rj+rp+rw+ri+cp+md.ic.bOPUQTldLq.png]
+
[[File:Device manager.png]]
  
 
On the Driver tab, click Update Driver.
 
On the Driver tab, click Update Driver.
  
[http://www.howtogeek.com/wp-content/uploads/2012/10/546x562ximage37.png.pagespeed.gp+jp+jw+pj+js+rj+rp+rw+ri+cp+md.ic.K3BCplypek.png http://www.howtogeek.com/wp-content/uploads/2012/10/546x562ximage37.png.pagespeed.gp+jp+jw+pj+js+rj+rp+rw+ri+cp+md.ic.K3BCplypek.png]
+
[[File:Driver properties.png]]
  
 
Use the Browse my computer for driver software option.
 
Use the Browse my computer for driver software option.
  
[http://www.howtogeek.com/wp-content/uploads/2012/10/650x533ximage38.png.pagespeed.gp+jp+jw+pj+js+rj+rp+rw+ri+cp+md.ic.riAXR7e-vw.png http://www.howtogeek.com/wp-content/uploads/2012/10/650x533ximage38.png.pagespeed.gp+jp+jw+pj+js+rj+rp+rw+ri+cp+md.ic.riAXR7e-vw.png]
+
[[File:Update driver software.png]]  
  
 
You’ll find the Google USB Driver in the “Extras” folder where you installed your Android SDK files. Select the&nbsp;<code>google\usb_driver</code>&nbsp;folder and click Next.
 
You’ll find the Google USB Driver in the “Extras” folder where you installed your Android SDK files. Select the&nbsp;<code>google\usb_driver</code>&nbsp;folder and click Next.
  
[http://www.howtogeek.com/wp-content/uploads/2012/10/709x581ximage39.png.pagespeed.gp+jp+jw+pj+js+rj+rp+rw+ri+cp+md.ic.yISyqgb6Ak.png http://www.howtogeek.com/wp-content/uploads/2012/10/709x581ximage39.png.pagespeed.gp+jp+jw+pj+js+rj+rp+rw+ri+cp+md.ic.yISyqgb6Ak.png]
+
[[File:Update driver software2.png]]
  
 
Once you’ve installed your device’s drivers,&nbsp;plug in your phone and try the adb devices command again:
 
Once you’ve installed your device’s drivers,&nbsp;plug in your phone and try the adb devices command again:

Revision as of 09:01, 25 January 2017

ADB, Android Debug Bridge, is a command-line utility included with Google’s Android SDK. ADB can control your device over USB from a computer, copy files back and forth, install and uninstall apps, run shell commands, and more.

We’ve covered some other tricks that require ADB in the past, including backing up and restoring your smartphone or tablet and installing Android apps to your SD card by default. ADB is used for a variety of geeky Android tricks.

Step One: Set Up the Android SDK

Head to the Android SDK download page and scroll down to “SDK Tools Only”, which is a set of tools that includes ADB. Download the ZIP file for your platform and unzip it wherever you want to store the ADB files–they’re portable, so you can put them anywhere you want.

Start the SDK Manager EXE and deselect everything except “Android SDK Platform-tools”. If you are using a Nexus phone, you may also want to select “Google USB Driver” to download Google’s drivers. Click the Install button. This downloads and installs the platform-tools package, which contains ADB and other utilities.

Android sdk manager.png

When it’s finished, you can close the SDK manager.

Step Two: Enable USB Debugging on Your Phone

Usb debugging1.jpg

To use ADB with your Android device, you must enable a feature called USB debugging. Open your phone’s app drawer, tap the Settings icon, and select “About Phone”. Scroll all the way down and tap the “Build Number” item seven times. You should get a message saying you are now a developer.

Head back to the main Settings page, and you should see a new option near the bottom called “Developer Options”. Open that, and enable “USB Debugging”.

Later on, when you connect your phone to your computer, you’ll see a popup entitled “Allow USB Debugging?” on your phone. Check the “Always allow from this computer” box and tap OK.

Step Three: Test ADB and Install Your Phone’s Drivers (if Needed)

Open the folder that you installed the SDK tools in and open the platform-tools folder. This is where the ADB program is stored. Hold Shift and right-click inside the folder. Choose “Open Command Window Here”.

Platform tools.png

To test whether ADB is working properly, connect your Android device to your computer using a USB cable and run the following command:

adb devices

Platform tools cmd.png

You should see a device in the list. If your device is connected but nothing appears in the list, you’ll need to install the appropriate drivers.

Your phone’s manufacturer may provide a downloadable driver package for your device. So head to their website and find the drivers for your device–Motorola’s are here, Samsung’s are here, and HTC’s come as part of a suite called HTC Sync Manager. You can also search XDA Developers for driver downloads without the extra software.

You can also try installing the Google USB Driver from the Extras folder in the SDK Manager window, as we mentioned in the first step. This will work with some phones including Nexus devices.

Android sdk manager2.png

If you use Google’s USB driver, you may have to force Windows to use the installed drivers for your device. Open the Device Manager (click Start, type Device Manager, and press Enter), locate your device, right-click it and select Properties. You may see a yellow exclamation mark next to the device if its driver isn’t installed properly.

Device manager.png

On the Driver tab, click Update Driver.

Driver properties.png

Use the Browse my computer for driver software option.

Update driver software.png

You’ll find the Google USB Driver in the “Extras” folder where you installed your Android SDK files. Select the google\usb_driver folder and click Next.

Update driver software2.png

Once you’ve installed your device’s drivers, plug in your phone and try the adb devices command again:

adb devices

If all went well, you should see your device in the list, and you are ready to start using ADB!

Step Four (Optional): Add ADB to Your System PATH

How to Edit Your System PATH for Easy Command Line Access in Windows

As it stands, you have to navigate to ADB’s folder and open a Command Prompt there whenever you want to use it. However, if you add it to your Windows System PATH, that won’t be necessary–you can just type adbfrom the Command Prompt to run commands whenever you want, no matter what folder you’re in.


The process is a bit different on Windows 7 and 10, so check out our full guide to editing your System PATH for the steps required to do this.