How do you adb to bluestacks 4? - android

I'd like to connect to android emulator on bluestacks 4 with adb.
but I've got an error with adb.exe -s emulator-5554 shell
checking devices.
$ adb.exe devices
List of devices attached
BH901... device
CB512... unauthorized
emulator-5554 device
once I shutdown bluestacks window, the emulator-5554 will be hidden from above command's result. thus I think emulator-5554 means bluestacks.
then commnad as below to use adb.
$ adb.exe -s emulator-5554 shell
error: closed
but as you know, an error occured.

First, in Bluestacks, go to Settings -> Preferences -> Enable Android Debug Bridge (ADB). Like this:
At this point, Bluestacks enables its adb functionality and exposes itself to the localhost at port 5555 (the default port)
So, in your command line, type adb connect localhost:5555 and you should be good to go.

I did exactly as the chosen approved answer but i still could not connect my android studio to Bluestack 4. Hence i think the problem both of us are encountering could be due to bluestack device ip has changed. (Even if you had detect the device using adb devices command earlier on). Each time i open up my bluestack emulator, i notice that its ip is always different. Hence that could be one of the reason why you could not add adb to bluestack4.
The following step works for me. I am using windows 10, Android Studio 4.0.1, Bluestacks 4.200.
find your android studio sdk platform tool folder. For me its is
custom installed in my D drive. for example->
D:\AppData\Local\Android\Sdk\platform-tools
right click on adb.exe and run as administrator. (click on yes if
a pop up ask if you would like to make changes to your devices.
After that you would only see another pop up that suddenly
disappear.)
open Bluestacks. Run your selected emulator (samsung/pixel etc).
Ensure that you have enable "Enable Android Debug Bridge (ADB) in
the emulator preferences.
open platform tools folder path: Click on address bar, alternatively press Alt + D. Now when address bar is highlighted, type cmd in the bar. Press Enter key.
enter the following command->adb connect xxxxxxxxxxx
where xxxxxx is your device localhost ip. (see attach pic. My device ip is
127.0.0.1:xxxxx hence my command is ->adb connect 127.0.0.1:xxxxx
continue with the following command->adb devices
you would see your bluestack emulator device. same ip listed.
open your andriod studio. you would be able to see your bluestack
emulator
[

And I have test bluestack 4 in windows 10 and enable the adb permission in bluestacks 4 settings. It works for me.

After enabling adb in blue stack
go to platform-tools folder
e.g. "C:\Users\Your Username\AppData\Local\Android\Sdk\platform-tools"
run this in cmd "adb connect localhost:5555" or whatever port given by bluestack.
or just run directly from Win+R
"C:\Users\Your
Username\AppData\Local\Android\Sdk\platform-tools\adb connect
localhost:5555"
n.b. localhost = 127.0.0.1

On BlueStack 5 it should be in Advanced -> Android Debug Bridge

Related

Android Studio does not recognize my phone as an android, but adb sees it

I've recently reinstalled my SDK. When trying to run the app, the device, although connected through USB, it is not displayed in the devices menu. When clicking troubleshoot device connections, when scanning for devices, it detects the phone, but not as an android.
(macos)
Go to SDK > platform-tool and Open terminal here.
Then fire below command
adb kill-server
abd start-server
Finally don't forget to enabled the USB debugging from developer options.

Android Studio to Bluestacks Connection Error

I am new to android development and was trying to use bluestacks to test my apps (as my pc won't run the emulator fast) but the bluestacks emulator is not being detected by android studio.
I started bluestacks and then ran my app. On the choose device dialog it doesn't show bluestacks.
I looked up in device monitor, but bluestacks wasn't detected there.
I also tried using adb kill-server, adb start-server, adb connect 127.0.0.1
but that didn't work as well. It says "connection could not be made as the target machine actively refused it".
All the solutions given in the other related stackoverflow post don't work. Android studio won't recognize bluestacks.
Please Help !!
Try in command prompt "netstat -anb" with administration privileges. Check if there is 127.0.0.1 5555 Estebalished.
If everything is OK then temporary disable firewall and type"adb connect 127.0.0.1:5555" should work.
i too have also gotten the error "connection could not be made as the target machine actively refused it" recently (when i tried to connect to adb using command prompt)
Trying with -> adb connect localhost:5555 or adb connect 127.0.0.1:5555 would not work. You need to identify your bluestack device ip address. You can identify the ip address using the preferences in your bluestack emulator setting. (where you enabled ADB in bluestack).
I did the following to resolve the error you had encountered and successfully connect Android studio to Bluestack. please try the following steps. (I am using windows 10, Android Studio 4.0.1, Bluestacks 4.200.)
find your android studio sdk platform tool folder. For me its is
custom installed in my D drive. for example->
D:\AppData\Local\Android\Sdk\platform-tools
right click on adb.exe
and run as administrator. (click on yes if a pop up ask if you would
like to make changes to your devices. After that you would only see
another pop up that suddenly disappear.)
open Bluestacks. Run your selected emulator (samsung/pixel etc). Ensure that
you have enable "Enable Android Debug Bridge (ADB) in the emulator
preferences.
open command prompt. cd to your platform tools folder path.
enter the following command->adb connect xxxxxxxxxxx where xxxxxx is your
device localhost ip. (see attach pic. My device ip is
127.0.0.1:xxxxx hence my command is ->adb connect 127.0.0.1:xxxxx
continue with the following command->adb devices you would see your bluestack
emulator device. same ip listed.
open your android studio. You would be able to see your bluestack emulator
[
i don't know if you fixed the issue or not but it's pretty simple to use bluestacks, if you see this screen when you open it like this all you have to do is run the app in android. it happens where android doesn't detect it because it wont see it as a device you either wait or try to get that screen (that sort of refreshs)
Just Need to do this!
Go to the SDK folder that you have got in your computer,then open the "platform-tools" folder,then open the "adb.exe" as administrator.
then try the BlueStack emulator.
if u got problem to connect with blue stack through android studio then follow following steps
in run(windows+R) put '%localappdata%\Android\Sdk\platform-tools' and check adb.exe is working correctly or not
If not then download file from
https://www.microsoft.com/en-us/download/confirmation.aspx?id=49093 which is
Update for Windows 7 for x64-based Systems (KB2999226) (related OS)
and install it.
allow adb.exe as exception in your virus scan software don't treat this exe as malware.
start your blue stack emulator.
go in setting of blue stack emulator go in preferences click checkbox 'Enable Android Debug Bridge'.
go to this location %localappdata%\Android\Sdk\platform-tools and run cmd through this location.
put command 'adb connect localhost:5555' press enter in command prompt.
start android studio then run project through play button popup will come with virtual device list, it will show your emulator's device.
...happy coding

Ecilpse won't recognize my device after upgrading to Kitkat (4.4.2)

I just upgraded my Android device to 4.4.2 and now Eclipse will not be able to choose a running Android device when I want to run my project. The Android Device Chooser shows my device up with a serial number as "????????????" and Target as "unknown" and State as "??". Additionally, I have enabled Developer Options with USB Debugging.
what os are you using. i see that on my linux box with some devices. i normally kill adb and restart it as root and the devices shows up and works correctly. found that solution years ago on stack overflow or something like that. not sure if the same thing is needed with windows/osx. on linux, assuming adb is in your path:
$ killall adb
$ sudo adb devices
otherwise os you're trying to connect it to and the specific device information would probably be helpful in tracking it down.
I have a few suggestions. Try them in this order until it works.
Reboot the phone.
Try turning off and then back on "USB Debugging" on your phone (in Developer Options probably).
open cmd > go to the your Android SDK directory > type cd platform-tools > type ./adb kill-server > then finally type ./adb start-server
References:
Eclipse - Target "unknown" in Android device chooser
Android device chooser - My device seems offline
The solution for my device after updating was to completely uninstall the device driver from device manager and reinstalling it. I am using windows and my mobile was shown as Android Phone and not as Nexus 7. Home it helps someone.

can't find android device in eclipse?

I am running android adt bundle in ubuntu and I am unable to connect my Sony Xperia S and run the applications on it. I saw these pages for setting up the hardware device.I have set up the udev rules ,as stated in the instructions and I have been successful to run ./adb devices and it gives a result as
List of devices attached
CB511YVUQC device
Even if the usb device is being shown but i can't see it in the AVD of eclipse.
Please Help.Thanks.
1.Please check Devices list from eclipse. Check this page also Android AVD not recognizing device but ADB does
2.try adb kill-server, adb start-sever
Maybe, you need activate USB Debugging: Settings -> Applications -> Development - Enable USB Debugging
Put your phone in Mass Storage mode(The default USB connection mode is MTP). After that, either reconnect the USB cable or try resetting adb.
Reset ADB from within Eclipse, and your device should show up.
In Eclipse, open the 'DDMS' Perspective, in the 'Devices' tab, in the far right, there is a triangle, inside of that, select 'Reset ADB'
Go in platform-tools and type adb kill-server then adb start-server platform-tools is in your sdk in my case is E:\adt-bundle-windows-x86_64-20140702\sdk\platform-tools

Android USB to Samsung Eclipse Cannot Connect

Right now I am trying to connect to Samsung Captivate. I see the device, but adb devices shows and empty list. Debugging in Eclipse I cannot see the device. I see it in the Windows 7 device list however. phone says connected. But adb devices does not list anything. What else do I need to do?
Samsung has a separate driver for connecting their Android devices for to Windows machines. I think there is an option in Kies to install this.
This solution is to connect via wifi, so there is no installation of drivers needed.
First
you need to download the shell terminal emulator on your android phone.
make sure both your android phone and computer are on the same wifi connection.
after downloading the application, open it and type this:
type "su" and press Enter.
type "setprop service.adb.tcp.port 5555" and press Enter.
type "stop adbd" and press Enter.
type "start adbd" and press Enter.
after that.
navigate through your SDK folder wherein you can find an "Adb.exe" and open that in CMD and type this.
type "adb connect " and press Enter.
and you are done.

Categories

Resources