How to connect android to android studio
How to connect android to android studio
How to connect my real device to android studio?
1 Answer 1
This answer is written based on the Windows-7 operating system. But these steps would work in any other similar windows versions, 8, 8.1, or 10.
How to check whether my device is identified Go to your SDK installed location. Usually it will be something like, C:\Users\Dodan\AppData\Local\Android\sdk
Go to platform-tools directory and start your command prompt from there,
then type “adb devices” and press enter.
If your device is identified, you will see a message similar to the following
List of devices attached
If you cannot see a device there, try the following possible solutions. Remember to re-do this step after trying each solution to identify whether your device was identified.
Make sure you have installed the android sdk You can find the sdk from the following link. If you have not installed it, download and install it from here, http://developer.android.com/sdk/installing/index.html
Usually this takes about 3GB of space from your hard disk
For example, for samsung devices, you can install the original software from the from the following link.
C:\Users \AppData\Local\Android\sdk\SDK Manager.exe
In the “Extras” section of the SDK manager, you will find an option named, “Google USB Driver”. Select it and install it.
Usually your device connects to the computer as an MTP device. Sometimes, changing it to Camera(PTP) or Mass Storage(USM) solves the issue.
From the Computer Management window, select, “Device Manager”
You will see your device under “other devices”, “Portable devices” or “Universal Serial Bus Controllers”.
Right click and select the update driver option.
Configure Knox security settings If your device is a samsung s6, you should additionally enable knox configurations listed under, settings->Security
Try Swapping USB ports and cables Sounds weird! But this has proven to be the problem many people had. Try plugging your device to different ports, or try using different cables. Some cables may either be incompatible or damaged.
Retry! I know that sounds bad. But, if any of those options does not work, you can either try restarting your machine, or reinstalling all the software, including android studio and the sdk, well may be, a different version.
How to connect and configure android studio on real time android device (Smartphones etc.)? [closed]
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
I have read a lot of blogs and saw many videos but no one explain how to run a Hello world App on a smartphone. Can somebody please help me in running a simple hello world program on android device.
3 Answers 3
Trending sort
Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.
It falls back to sorting by highest score if no posts are trending.
Switch to Trending sort
Here everything is explained from how to connect and configure android studio with android real time device (in your case Smartphone) and then run Hello World App. I hope it will resolve your query. All the Best. Happy Coding 🙂
Install usb_drivers in machine and turn Developer options in device and you can run android application into device directly.
You need to do the following in your smartPhone.
Once you complete all these steps, your device is now ready to be a development device.
In case if you have not downloaded the USB drivers for your device already [ this is to ensure your device is visible as you connect via USB], please do the same from the device manufacturer site. Most of the devices will download this automatically, but a few devices we need to do this ourselves.
Once these things are done, now when you click on Run in Android Studio on your «hello world» project, you should see YOUR DEVICE also in the list.
Run apps on a hardware device
When building an Android app, it’s important that you always test your app on a real device before releasing it to users. This page describes how to set up your development environment and Android device for testing and debugging over an Android Debug Bridge (ADB) connection.
Note: Use the Android emulator to test your app on different versions of the Android platform and different screen sizes. Also consider using Firebase Test Lab to run your app on a wide variety of real devices hosted in a cloud-based infrastructure.
Set up a device for development
Before you can start debugging on your device, decide if you want to connect the device to using a USB cable or Wi-Fi. Then do the following:
On the device, open the Settings app, select Developer options, and then enable USB debugging (if applicable).
Set up your system to detect your device.
Ubuntu Linux: There are two things that need to be set up correctly: each user that wants to use adb needs to be in the plugdev group, and the system needs to have udev rules installed that cover the device.
plugdev group: If you see an error message that says you’re not in the plugdev group, you’ll need to add yourself to the plugdev group:
Note that groups only get updated on login, so you’ll need to log out for this change to take effect. When you log back in, you can use id to check that you’re now in the plugdev group.
udev rules: The android-sdk-platform-tools-common package contains a community-maintained default set of udev rules for Android devices. To install:
Windows: Install a USB driver for ADB (if applicable). For an installation guide and links to OEM drivers, see the Install OEM USB drivers document.
Connect to your device using USB
You can also use adb to issue commands, as follows:
Connect to your device using Wi-Fi
Android 11 (and later) supports deploying and debugging your app wirelessly from your workstation via Android Debug Bridge (adb). For example, you can deploy your debuggable app to multiple remote devices without physically connecting your device via USB and contending with common USB connection issues, such as driver installation.
To use wireless debugging, you need to pair your device to your workstation using a pairing code. To begin, complete the following steps:
To connect to your device, follow these steps:
After you are paired, you can attempt to deploy your app to your device.
To pair a different device or to forget this device on your workstation, navigate to Wireless debugging on your device, tap on your workstation name under Paired devices, and select Forget.
Troubleshoot device connection
If your device is not connecting to Android Studio, try the following to resolve the issue.
Troubleshoot with the Connection Assistant
The Connection Assistant provides step-by-step instructions to help you set up and use a device over the ADB connection.
To start the assistant, choose Tools > Troubleshoot Device Connections.
The Connection Assistant provides instructions, in-context controls, and a list of connected devices in a series of pages in the Assistant panel. Use the Next and Previous buttons at the bottom of the Assistant panel to work through the pages as needed:
Resolve USB connection issues
If the Connection Assistant is not detecting your device over USB, you can try the following troubleshooting steps to resolve the issue:
Check that Android Studio can connect to the Android Emulator
To check if the issue is being caused by a connection problem between Android Studio and the Android Emulator, follow these steps:
Check the USB cable
To check if the issue is being caused by a faulty USB cable, follow the steps in this section.
If you have another USB cable:
If you don’t have another USB cable but you do have another Android device:
If the Connection Assistant can detect the secondary device, assume that the problem is with the primary device and check if the device is set up for development.
If the secondary device is not detected, the problem might be with the USB cable.
Check if the device is set up for development
To check if the issue is being caused by settings on the device, follow these steps:
Resolve wireless connection issues
If you are having issues connecting to your device wirelessly, you can try the following troubleshooting steps to resolve the issue.
Check if your workstation and device meet the prerequisites
To meet the prerequisites for wireless debugging, ensure that:
Check for other known issues
The following is a list of current known issues with wireless debugging in Android Studio and how to resolve them.
RSA security key
When you connect a device running Android 4.2.2 (API level 17) or higher to your computer, the system shows a dialog asking whether to accept an RSA key that allows debugging through this computer. This security mechanism protects user devices because it ensures that USB debugging and other adb commands cannot be executed unless you’re able to unlock the device and acknowledge the dialog.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
How to test android apps in a real device with Android Studio?
Waiting for device. USB device not found
11 Answers 11
Trending sort
Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.
It falls back to sorting by highest score if no posts are trending.
Switch to Trending sort
I can run on my device at last, just I enabled the «USB debugging» and «Allow mock location» options from the Debug Menu of my device.
I have a Nexus 4 and own a Thinkpad L430 Windows 8.1
My errors: «Waiting for device. USB device not found»
I went to: Device Manager > View > Drop to «Acer Device» > Right click on Acer Composite ADB Interface > Update it
Afterward, Reboot/Restart your computer. Once it turned on Plug Your USB Device onto the computer.
Go to: Setting > Enable «Developer options» > Check the «USB debugging» option > Check «Allow mock locations» > Check «Verify apps over USB».
Swipe down from the drop down menu of your phone where it Shows the USB Connection Icon. Tap on USB Computer Connection > Select the Check box «Camera (PTP)»
Run your Android Studio App and it should work
To test an android apps in a real device with Android Studio, You must keep two things in mind
Now let me tell you how you can download the driver on your Windows PC:
Running Apps on Your Device
When building an Android app, it’s important that you always test your application on a real device in addition to emulators. This page describes how to set up your development environment and Android-powered device for testing and debugging on the device.
If you want an ideal SIM-unlocked phone to test on, then you might consider a Pixel phone.
Plug in your device to your computer with a USB cable. If you’re developing on Windows, you might need to install this universal ADB USB driver or find your specific USB driver for your device.
The next step is to enable USB debugging so your phone can interact with your computer in a developer mode.
The following steps are needed:
Watch this video tutorial for a visual guide to getting USB debugging enabled.
Now, we can launch apps from Android Studio onto our device:
Once Gradle finishes building, Android Studio should install the app on your connected device and start it.
Not seeing your device in the «Choose Device» window? Try the following:
Now the phone should work as a debugging device as expected!
Still Not Working?
If after plugging the device into the computer and you don’t see any message about authorizing the device, then you may need to purchase another USB cable. Not all USB cables are enabled for data transfer. If there’s a chance that your cable may be a charging only cable, you can purchase a USB-C cable for Pixel or the micro-USB cable for Nexus 6 and prior.
Источники информации:
- http://stackoverflow.com/questions/36098757/how-to-connect-and-configure-android-studio-on-real-time-android-device-smartph
- http://developer.android.google.cn/studio/run/device.html?hl=en-GB
- http://stackoverflow.com/questions/21947834/how-to-test-android-apps-in-a-real-device-with-android-studio
- http://guides.codepath.com/android/Running-Apps-on-Your-Device