How To Install App From Android Studio
Installing on a Device
In Configuring an AVD, we describe how to gear up a virtual device for debugging, but our ultimate target is for our programs to run on actual hardware. To install and execute programs on hardware y'all must
- Configure the mobile device and estimator for hardware debugging,
- Connect the device to the development computer with a USB cable, and
- Transfer the executable to the device from the evolution computer.
Let us showtime describe how to configure for debugging and and so how to transfer the executables.
On Android 4.2 and newer devices, the Programmer options required in the following instructions are hidden by default. To make them available on those devices, go to Settings > About phone and tap Build number seven times. Then you should observe Developer options displayed nether Settings.
Configuring for Debugging on Actual Devices
We summarize the basics; a more extensive discussion may be found in the Android Run Apps on a Hardware Device certificate. Configuring the phone or tablet may be somewhat device-specific but should be like to the following case for a Motorola Moto-X phone running Android 4.4.two.
- Go to Settings > {} Developer options and enable the USB debugging option. The following figure illustrates.
Note: on devices running versions of Android older than 4.0 this choice volition instead exist found nether Settings > Applications > Evolution.
"Stay awake" has too been checked to cause the screen display to stay on while the phone is charging on the USB cable; information technology is often useful in debugging for the screen to stay on, but this is non essential.
- Configuration of the development computer depends on the operating system:
- Windows requires installation of an Android USB driver. Here are the instructions for Nexus devices and instructions for other devices.
- Macs should be ready to go.
- Linux systems may be prepare to get, or may need some additional configuration, depending on the Linux flavor. My Fedora systems require no further setup but Ubuntu systems may need some drivers enabled. Run into Run Apps on a Hardware Device for further discussion.
- Connect the device to your evolution computer with a USB cable appropriate for the device. Notation: it needs to be a USB information cable, not just a charging cable. Most Android charging cables are too information cables, simply I have encountered some cheap ones that don't support data transfer.
- If things are well you volition probably become a message on the computer that a USB device has been connected, which you can ignore unless a permission is requested. You will probably too get a popup on the device asking whether you will take the connection. Say Aye. (There will probably as well exist a box to check if you want to allow connection to this computer in the time to come without having to give explicit permission.)
- To confirm that your device is continued after the above steps, issue at a trounce prompt adb devices (where adb is in the platform-tools subdirectory of the SDK: nosotros are bold that you added this directory to your path earlier). Your device should announced in the list of devices that this control produces. For case, on my Fedora Linux organisation a typical result would be
[guidry@m33 sdk]$ adb devices List of devices attached 0146B5BA13010009 device emulator-5554 device
Y'all may also verify the devices connected by opening the DDSM perspective in Android Studio (Tools > Android > Android Device Monitor), and checking under the Devices tab. For example, the following image shows one hardware device and i emulator: a Huawei Nexus 6P telephone running Android 6.0.ane, and an AVD running Android vi.0 and connected to Android Studio on port 5554.
Now that the device is continued to the reckoner, Android packages that we have adult can exist installed and debugged directly on the device. Allow's see how to practise that.
Installing and Debugging Applications on the Device
To install an application on a physical device continued to your development computer by a USB cable as described higher up, execute the app using Android Studio: click the Run push button, or choose from the carte du jour Run > Run 'app', and select the device for output in the resulting Select Deployment Target window, as illustrated in the following effigy.
With the concrete device selected, clicking OK will both install the app in the appropriate directory on the device and execute the application on the device if there are no errors.
Compatibility of Digital Signatures
For security, Android requires that all applications installed on physical devices be digitally signed by the programmer. If you lot deploy apps for 3rd-party installation through channels such as the Google Play Store y'all must sign them with your own digital signature, but in evolution and debugging using Android Studio this isn't necessary because "under the hood" a debug certificate associated with the development machine is used automatically.
If yous debug on a device using a particular computer, the app will be installed using the debug certificate associated with that machine. If yous leave the app installed and then attempt to debug the same device on a different reckoner, you will get an error message in the logcat stream that the awarding signatures do non match. For example,
[2010-06-08 ten:34:06 - MapTutorial] Installing MapTutorial.apk... [2010-06-08 x:34:08 - MapTutorial] Re-installation failed due to unlike application signatures. [2010-06-08 x:34:08 - MapTutorial] You must perform a full uninstall of the application. Warning: This will remove the awarding data! [2010-06-08 10:34:08 - MapTutorial] Please execute 'adb uninstall com.lightcone.maptutorial' in a shell. [2010-06-08 10:34:08 - MapTutorial] Launch canceled!
In this case, use the uninstall command described beneath first to remove the application from the device, and then repeat the install equally described in a higher place.
More recent versions of the evolution tools may give a popup directly in Android Studio asking you if you want to uninstall the old app and install the i with the new signature.
Uninstalling Applications from the Device
To uninstall an awarding resident on a physical device connected past USB:
- Issue from the command line of a beat out adb devices to go a list of currently-running devices and their serial numbers.
- Issue the command adb -s <serialNumber> uninstall appname, where <serialNumber> is the serial number for the device and appname is the fully qualified proper noun of the app package. For case,
If you lot know there is only a single device running, you can shorten the in a higher place to adb -d uninstall appname (the -d flag targets the only concrete device running). For example,[guidry@m33 ~]$ adb devices List of devices attached TA5380467L device emulator-5554 device [guidry@m33 ~]$ adb -due south TA5380467L uninstall com.lightcone.recipes Success
(This returns an error if more than one physical device is running.)[guidry@m33 workspaceAndroid]$ adb -d uninstall com.lightcone.recipes Success
The application can as well be uninstalled manually from the device. The exact procedure will depend on the device merely will likely be like to: Go to Settings > Apps , select the awarding from the list that is populated, and press Uninstall.
Last modified: July 25, 2022
Source: http://eagle.phys.utk.edu/guidry/android/installOnDevice.html
Posted by: moorehonew1961.blogspot.com
0 Response to "How To Install App From Android Studio"
Post a Comment