When Preparing A Computer To Use A Sideloaded App, Which Of The Following Commands Activates A Key?
Being able to run Android apps on a Chromebook is great, it gives users access to the vast Android ecosystem offerings and it gives Android developers the opportunity to reach Chrome OS users.
Developers should make a point to verify their apps on different form factors, since this will help improve users' experiences. This is why Chrome OS provides Android developers with the tools to deploy and test their apps on Chromebooks.
Whether developers are deploying their Android app directly from Chrome OS (using Android Studio in your Chromebook) or from another device, developers can use ADB to deploy their apps and debug different interactions with Chromebooks. For more details checkout the steps below.
Enable ADB debug
Previously, using ADB on your Chromebook was only possible while in developer mode, which requires powerwashing (resetting) the device and can reduce security. Luckily since Chrome 81, developers can keep their devices out of developer mode and still deploy apps they develop directly in Chrome OS, with the flip of a switch. Here is how:
First, make sure the Chromebook is not in developer mode. Then go to settings and turn on Linux (if you haven't done so before).
Once Linux is available open the Linux settings and you'll find a new option Develop Android apps, open that option.
Toggle enable ADB debugging and the computer will restart.
When the computer restarts you'll see a message that lets you know that there may be applications that were not downloaded from the app store on the device.
ADB is now available to deploy apps to your Chromebook, run debugging commands and interact directly with the device.
To ensure that your Android app works well on a variety of Chromebook devices and available form factors, Google recommends that you test your app on the following devices:
- An ARM-based Chromebook
- An x86-basedChromebook
- A device with a touchscreen and one without one
- A convertible device; that is, one that can change between a laptop and a tablet
- A device with a stylus
Deploy from Chrome OS
After enabling ADB debugging, you can load an Android app directly onto your Chrome OS device using Android Studio or if you have an APK you can load it using the Terminal.
Deploy with Android Studio
After you have set up Android Studio and the ADB as described above, you can push your apps to the Chromebook's Android container directly from Android Studio. The Chromebook will appear as an option in the device drop down:
Now you can push your app like any other Android device! The ADB authorization dialog appears.After you authorize your application will launch in a new window.
That's it, you can now deploy the app to the Chromebook, test and debug without the hassle of being in developer mode.
Deploy with Terminal
Install ADB if necessary:
sudo apt install adb
Connect to the device:
adb connect arc
An authorization popup for USB debugging appears. Grant it.
Install your app from the terminal:
adb install [path to your APK]
Deploy from another device
If you can't use the method described above and need to push your app from another device, you can connect the device to ADB using USB or a network address.
To push your APK from another device into the Chromebook, you must start your Chrome OS in developer mode so that you can configure the Chromebook and push apps from the host machine. Follow this steps to get into developer mode
Connect to ADB over USB
- Enable ADB debugging.
- Determine if your device supports USB debugging
- Press Control + Alt + T to start the Chrome OS terminal.
-
Type
shell
to get to the bash command shell:crosh> shell chronos@localhost / $
-
Type the following commands to set up your device:
$ sudo crossystem dev_enable_udc=1 $ sudo reboot
-
After rebooting, open the terminal again and run the following command to enable ADB on the Chromebook's USB port:
$ sudo ectool usbpd <port number> dr_swap
Use this command each time you disconnect and reconnect a USB cable. To ensure your Chromebook is in UFP mode, you can run ectool usbpd <port number>
.
- Plug in a USB cable to a supported port on your device
- Run
adb devices
from the Android SDK platform tools on your host machine to see your Chromebook listed as an ADB supported device - On your Chromebook, click Allow when prompted whether you want to allow the debugger. Your ADB session is established.
Connect to ADB over a network
- Enable ADB debugging.
In order to debug over a network, you must configure the Chrome OS firewall to allow incoming ADB connections:
- Press Control + Alt + T to start the Chrome OS terminal.
-
Type
shell
to get to the bash command shell:crosh> shell chronos@localhost / $
-
Type the following commands to set up developer features and enable disk-write access for the firewall settings changes. If you need to enter a sudo password for the
chronos
user, you can (re)set one by runningchromeos-setdevpassword
at the VT-2 prompt which is accessible by pressing Control + Alt + forward-arrow. You will need your root password.$ sudo crossystem dev_boot_signed_only=0 $ sudo /usr/libexec/debugd/helpers/dev_features_rootfs_verification $ sudo reboot
-
The
sudo reboot
command restarts your Chromebook. You can press the Tab key to enable autocompletion of file names. You must complete this procedure only once on your Chromebook.
After your device restarts, log in to your test account and type the following command to enable the secure shell and configure the firewall properly:
$ sudo /usr/libexec/debugd/helpers/dev_features_ssh
When the command completes, you can exit out of the shell.
Get the IP address of your Chromebook:
- Click the clock in the bottom-right area of the screen.
- Click the gear icon.
- Click the network type you are connected to (Wi-Fi or Mobile data) then the name of the network.
- Take note of the IP Address.
Connect to your Chromebook:
-
Return to your development machine and use ADB to connect to your Chromebook using its IP address:
adb connect <ip_address>:22
-
On your Chromebook, click Allow when prompted whether you want to allow the debugger. Your ADB session is established.
Troubleshooting ADB debugging over a network
Sometimes the ADB device shows that it's offline when everything is connected properly. In this case, complete the following steps to troubleshoot the issue:
- Deactivate ADB debugging in Developer options.
- In a terminal window, run
adb kill-server
. - Re-activate the ADB debugging option.
- In a terminal window, attempt to run
adb connect
. - Click Allow when prompted whether you want to allow debugging. Your ADB session is established.
When Preparing A Computer To Use A Sideloaded App, Which Of The Following Commands Activates A Key?
Source: https://developer.android.com/topic/arc/development-environment
Posted by: mazzolasubal1958.blogspot.com
0 Response to "When Preparing A Computer To Use A Sideloaded App, Which Of The Following Commands Activates A Key?"
Post a Comment