Xda windows on android

How to Install ADB on Windows, macOS, and Linux

Lately here at XDA we have been writing a number of tutorials to show you how to access certain features of the Android platform that simply are not visible to the user. These have generally been done with the help of some command line Android Debug Bridge (ADB) commands, a tool that Google offers for developers to debug various parts of their applications or the system, but which we can use for all kinds of neat and hidden tricks. Using the command line isn’t something that everyone is comfortable with, though, so in an attempt to teach everyone how to do these tweaks (no matter what skill level you’re at), we have been including some basic steps about how to install ADB in each of our tutorials where necessary.

Well, the number of our tutorials has ballooned in quantity lately, so we have decided to exclude those steps from future tutorials to avoid redundancy. However, we still want all future tutorials we write to be easy to understand for as many people as possible, so that will be the point of today’s guide. Having a dedicated step by step tutorial on how to install and setup ADB on your computer (no matter what operating system you use) will be great for those who may not have it set up already.

This will also let us include a link to this guide in the future tutorials we write that require you to have ADB setup and installed on your computer. So when one of our new tutorials comes out that requires ADB, you can click through the link to learn how to install ADB or you can simply ignore it and move onto the next step. Since ADB can be used on a variety of operating systems, we’ll be covering some basic instructions for Windows, macOS and Linux.

How to Setup the Android Debug Bridge (ADB)

Note: Setting up ADB on the computer is just half the equation since you’ll also need to do some things on the smartphone or tablet to accept the ADB commands.

Phone Setup

  1. Launch the Settings application on your phone.
  2. Tap the About Phone option generally near the bottom of the list.
  3. Then tap the Build Number option 7 times to enable Developer Mode. You will see a toast message when it is done.
  4. Now go back to the main Settings screen and you should see a new Developer Options menu you can access.
  5. Go in there and enable the USB Debugging mode option.
  6. You are partially done with the phone setup process. Next up, you will need to scroll below and follow the rest of the instructions for your particular operating system.

Follow along for the operating system on your computer.

How to setup ADB on Microsoft Windows

  1. Download the Android SDK Platform Tools ZIP file for Windows.
  2. Extract the contents of this ZIP file into an easily accessible folder (such as C:\platform-tools)
  3. Open Windows explorer and browse to where you extracted the contents of this ZIP file
  4. Then open up a Command Prompt from the same directory as this ADB binary. This can be done by holding Shift and Right-clicking within the folder then click the “Open command window here” option. (Some Windows 10 users may see “PowerShell” instead of “command window”.)
  5. Connect your smartphone or tablet to your computer with a USB cable. Change the USB mode to “file transfer (MTP)” mode. Some OEMs may or may not require this, but it’s best to just leave it in this mode for general compatibility.
  6. In the Command Prompt window, enter the following command to launch the ADB daemon:В adb devices
  7. On your phone’s screen, you should see a prompt to allow or deny USB Debugging access. Naturally, you will want to grant USB Debugging access when prompted (and tap the always allow check box if you never want to see that prompt again).
  8. Finally, re-enter the command from step #6. If everything was successful, you should now see your device’s serial number in the command prompt (or the PowerShell window).

Yay! You can now run any ADB command on your device! Now go forth and start modding your phone by following our extensive list of tutorials!

Читайте также:  Почему нельзя отформатировать диск при установке windows 10 с флешки

How to setup ADB on macOS

  1. Download the Android SDK Platform Tools ZIP file for macOS.
  2. Extract the ZIP to an easily-accessible location (like the Desktop for example).
  3. Open Terminal.
  4. To browse to the folder you extracted ADB into, enter the following command:В cd /path/to/extracted/folder/
  5. For example, on my Mac it was this: cd /Users/Doug/Desktop/platform-tools/
  6. Connect your device to your Mac with a compatible USB cable. Change the USB connection mode to “file transfer (MTP)” mode. This is not always required for every device, but it’s best to just leave it in this mode so you don’t run into any issues.
  7. Once the Terminal is in the same folder your ADB tools are in, you can execute theВ following command to launch the ADB daemon:В ./adb devices
  8. On your device, you’ll see an “Allow USB debugging” prompt. Allow the connection.
  9. Finally, re-enter the command from step #7. If everything was successful, you should now see your device’s serial number in macOS’s Terminal window.

Congratulations! You can now run any ADB command on your device!В Now go forth and start modding your phone by following our extensive list of tutorials!

While the guide above will certainly work, some seasoned macOS users should be aware that there can be an easier way to install ADB on their Macs using an unofficial package manager such as Homebrew or MacPorts.

How to setup ADB on Linux

  1. Download the Android SDK Platform Tools ZIP file for Linux.
  2. Extract the ZIP to an easily-accessible location (like the Desktop for example).
  3. Open a Terminal window.
  4. Enter the following command:В cd /path/to/extracted/folder/
  5. This will change the directory to where you extracted the ADB files.
  6. So for example: cd /Users/Doug/Desktop/platform-tools/
  7. Connect your device to your Linux machine with your USB cable. Change the connection mode to “file transfer (MTP)” mode. This is not always necessary for every device, but it’s recommended so you don’t run into any issues.
  8. Once the Terminal is in the same folder your ADB tools are in, you can execute theВ following command to launch the ADB daemon:В ./adb devices
  9. Back on your smartphone or tablet device, you’ll see a prompt asking you to allow USB debugging. Go ahead and grant it.
  10. Finally, re-enter the command from step #8. If everything was successful, you should now see your device’s serial number in the Terminal window output.

Congrats! You can now run any ADB command on your device!В Now go forth and start modding your phone by following our extensive list of tutorials!

Some Linux users should be aware that there can be an easier way to install ADB on their computer. The guide above will certainly work for you, but those own a Debian or Fedora/SUSE-based distro of Linux can skip steps 1 and 2 of the guide above and use one of the following commands:

  • Debian-based Linux users can type the following command to install ADB:
  • Fedora/SUSE-based Linux users can type the following command to install ADB:

However, it is always better to opt for the latest binary from the Android SDK Platform Tools release, since the distro-specific packages often contain outdated builds.

Just to cover all of our bases here, users may need to put a ./ in front of the ADB commands we list in future tutorials, especially when they are using the extracted binaries directly from the Platform Tools ZIP. This is something that is likely known by any *nix user (or Windows user running PowerShell) already, but again, we want as many people as possible to understand how to do these tweaks for Android no matter how much of your operating system you know.

Next Steps

To check if you have successfully installed ADB, connect your device to your PC/Mac with your USB cable, and run the adb devices command as described above. It should display your device listed in the Command Prompt/PowerShell/Terminal window. If you get a different output, we recommend starting over with the steps.

Bonus

For those who want to take this a step further, you can follow this new tutorial we put together that will walk you through how to setup ADB so that you can use the command from any directory on a Windows or Linux desktop.

How to run multiple Android apps on your Windows 10 PC with Microsoft’s Your Phone

As a part of its partnership with Microsoft, Samsung had announced during the launch of the Galaxy Note 20 in August last year that the Your Phone app would soon offer support for running multiple apps on Windows. Following the announcement, Microsoft had started rolling out the feature to users who had opted for the Windows Insider program in November. The feature recently became generally available for all users with select Samsung smartphones.

According to Analy Otero Diaz, Principal Program Manager at Microsoft, the multiple apps experience in the Your Phone app is now available to all users running the Windows 10 May 2020 update or later. In order to run multiple apps from your Samsung device via Your Phone on Windows, there are a few prerequisites. These include the following:

  • The latest Windows 10 May 2020 update or later. It is recommended that you update to the latest version of Windows 10. You can check and update by heading to Settings > Updates & Security > Check for update
  • A recommended 8GB of RAM on your Windows PC
  • The latest version of Your Phone app on your Windows PC with version 1.20102.132.0 or higher
  • Your Phone companion app to link Windows with your Samsung device. Make sure you have version 1.20102.133.0 or higher. You can download the app from the Google Play store
  • You also need the latest Link to Windows Service with version 2.1.05.2 or higher. This can be downloaded from the Galaxy Store
  • Both the phone and PC should be connected to the same Wi-Fi network
Читайте также:  Telegram apk windows phone

While Microsoft mentions that you need an Android 11 device to enable multi-app support on Your Phone, not all devices running Android 11 are supported. On a separate page, Microsoft lists all supported smartphones which currently only includes a bunch of Samsung devices. Here is the full list:

  • Samsung Galaxy Fold
  • Samsung Galaxy Note20 5G
  • Samsung Galaxy Note20 Ultra 5G
  • Samsung Galaxy S20
  • Samsung Galaxy S20+
  • Samsung Galaxy S20 FE
  • Samsung Galaxy S20 Ultra
  • Samsung Galaxy Z Flip
  • Samsung Galaxy Z Flip 5G
  • Samsung Galaxy Z Fold2 5G
  • Samsung Galaxy Note10
  • Samsung Galaxy Note10+
  • Samsung Galaxy Note10 Lite

How to run multiple Android apps on Windows using Your Phone:

  1. Once you have met all the requirements mentioned above, open the Your Phone app on your Windows PC
  2. The app will ask you to select between Android or iPhone. Select Android and click on Continue
  3. Next, you will be asked to install/update to the latest version of Your Phone Companion app on your Samsung smartphone by heading to this link (www.aks.ms/yourpc)
  4. After you have installed/updated the companion app on your phone, confirm the same on the Your Phone app on your PC and open the QR code
  5. On your supported Samsung smartphone, head over to Settings > Advanced Features and head to Link to Windows
  6. Enable the service and tap on Add Computer and use the phone’s camera to scan the QR code displayed on the Your Phone app on your PC
  7. Sign in to your Microsoft account and wait for a confirmation to allow your phone to be connected to your PC
  8. You should now be able to see your phone on the Your Phone PC app
  9. Head over to the Apps section on the left to get access to all apps installed on your phone

How to interact with apps:

One can interact with apps using your PC’s mouse, trackpad, keyboard, pen, or touch-enabled screen. Here are some tips if you are using a mouse and keyboard:

  • Single click  will behave the same as any single touch/tap interaction
  • Right click  anywhere on your phone screen to navigate to the previous page
  • Click and hold will behave the same as a tap/hold interaction
  • Click and hold and drag to select content
  • Mouse scroll to move between pages vertically or horizontally

Android Nougat’s Freeform Window Mode: What It Is and How Developers Can Utilize It

Freeform window mode, as first demonstrated by Ars Technica

When Android 7.0 Nougat was first announced early in 2016, it brought with it a much-requested feature to the Android platform — multi-window support. Most people are aware of the split-screen multi-window support enabled by default on all Android Nougat phones and tablets. Android TV devices with Android Nougat come with support for picture-in-picture multi-window support.

However, there is a third multi-window mode present in Android Nougat that not very many people are aware of: freeform window mode. This mode allows Android to present apps as floating windows that can be moved and resized at will by the user. It’s essentially Android’s implementation of a stacking window manager.

Manufacturers of larger devices can choose to enable freeform mode, in which the user can freely resize each activity. If the manufacturer enables this feature, the device offers freeform mode in addition to split-screen mode.

Device implementations with screen size xlarge SHOULD support freeform mode.

This indicates that any new large screen Android device that ships with Android 7.0 could potentially have freeform window mode enabled by the manufacturer.

However, this is absolutely not a hard requirement. It is possible to force any Android Nougat device (with developer options enabled) to support freeform window mode using one of two different methods:

Enabling freeform window mode on any Android Nougat device

Turning on the “Force activities to be resizable” option allows apps to run in freeform mode on any device

Method 1 (a computer with adb is required)

Make sure USB Debugging is enabled in Developer Options. Then, hook your device up to a computer with adb installed, and execute the following command:

Method 2 (no additional requirements)

Enable the “Force activities to be resizable” option at the bottom of Developer Options.

Both of these methods require the System UI to be restarted before they can take effect. The easiest way to do this is to reboot your device (or, if your device is rooted, you can simply kill the com.android.systemui process)

OK, so freeform mode is enabled… now what?

If you enabled freeform mode using Method 1, then there will be a new button on app entries in the Overview menu to launch an app into freeform window mode.

Читайте также:  Ремонт windows mixed reality

With Method 2, however, it is not possible to launch an app into freeform mode through Android itself. Fortunately, it is possible for any third-party launcher to launch an app into freeform window mode using standard Android APIs that were finalized as part of API level 24.

The key to launching an app in freeform mode is to call the ActivityOptions.setLaunchBounds() method. This method takes a Rect as an argument, containing the window bounds that the app will launch with.

You can then start the app with startActivity(Intent, Bundle) . If you don’t already have an ActivityOptions bundle, you can create one with ActivityOptions.makeBasic() and then calling setLaunchBounds() on the freshly created bundle.

Note that by default, if there is already a task for the app present in the Overview screen, then Android will simply redirect you to the existing (fullscreen) task that was previously launched by the user. You will need to clear any tasks for the app in Overview before attempting to launch the app into a freeform window. (For apps with activities that launch in standard or singleTop modes, you can force a new window to open by adding the Intent.FLAG_ACTIVITY_MULTIPLE_TASK flag to the intent before calling startActivity() .)

How does freeform mode work under-the-hood?

There is an excellent article written that explains how multi-window mode, including freeform mode, is implemented in Android Nougat. (NOTE: the article is written in Chinese, so be sure to run it through Google Translate)

In a nutshell, apps in freeform mode run in a separate stack from the rest of the system (think: virtual desktop). Therefore, it is not possible for freeform apps to run on top of the launcher or on top of another full-screen app.

Apps running in freeform mode (that don’t have android:windowIsFloating set to true) have a DecorCaptionView added as a child of the top-level DecorView . This view contains a LinearLayout defining the window’s caption bar for moving, maximizing, and closing the window. While I don’t recommend it personally, it is possible to access and customize this view by getting the DecorView using Window.getDecorView() , casting it to a ViewGroup and then accessing its child views.

Any app that is designed to behave well in Android’s standard split-screen multi-window mode will work in freeform mode. isInMultiWindowMode() will return true for apps running in freeform mode. There are a few other publicly-available classes and methods that an app can use that relate specifically to freeform mode:

  • Window.setDecorCaptionShade() : this method can be used to override the shade of the caption controls (the maximize and close button) for apps in freeform mode.
  • Window.setRestrictedCaptionAreaListener() : this can be used to detect when a window is moved around in freeform mode. The Window.OnRectrictedCaptionAreaChangedListener is called every time the position of the caption controls change (when a user moves the window around), and provides a Rect with the new bounds of the caption controls.
  • ActivityInfo.WindowLayout : this class contains information declared in the app’s manifest as to the initial positioning of a freeform window that an app can request on launch. For example, you can list the following in the tag of your manifest:

Then, when the device is already in freeform mode and the app is launched, it will launch with these specified boundaries.

Examples of freeform window mode in action

Taskbar adds a start menu and recent apps tray to compliment freeform window mode

In the summer of 2016, while Android Nougat was still a developer preview, I released an app called Taskbar that provides a Windows-like start menu and recent app list in a system overlay. It allows users on Nougat to launch apps in freeform window mode — and, since Taskbar uses an overlay, it can stay on screen in the freeform window environment. The combination of Taskbar and freeform mode gives any Android device, especially tablets, a PC-like feel.

You can download Taskbar on Google Play, or view the source code yourself on GitHub. In addition to the concepts mentioned in this article, I also employ a few tricks to keep the freeform mode environment active even when no freeform windows are displayed on screen. Users can also optionally set Taskbar as their default launcher to allow their device to boot automatically to the freeform mode environment.

Since there are no devices that officially ship with freeform window support enabled by the OEM (as of this writing), I recommend using Taskbar as a tool for developers to test their apps in the freeform window environment on devices that don’t otherwise support it.

In addition to Taskbar, I’ve also modified the Launcher3 source code from AOSP to allow it to launch apps into freeform mode. This is a straight clone of the stock Android 7.1.1 launcher, with the bare minimum modifications necessary to allow it to launch freeform apps. I’ve provided this modified launcher in the hope that other developers will implement support for launching freeform windows in their custom launchers. You can view the source code on GitHub, or download a sample APK.

My hope is that developers of custom launchers can utilize this code and enable support for launching freeform window apps for those users that desire greater flexibility for window management on their large-screened devices.

Оцените статью