Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can't get my devices #50

Closed
gdetra opened this issue Jan 28, 2017 · 23 comments
Closed

I can't get my devices #50

gdetra opened this issue Jan 28, 2017 · 23 comments

Comments

@gdetra
Copy link

gdetra commented Jan 28, 2017

Can you tell me how can i recognize my device with adb enabled?
i have tried getAnyDevice method but nothing to do.. help me please!!

@SKART1
Copy link
Collaborator

SKART1 commented Jan 28, 2017

Can you provide more information about regime in which adb is started?

Does adb devices show anything?
Is it real device or emulator?
What OS are you using?

@gdetra
Copy link
Author

gdetra commented Jan 28, 2017

i'm under Windows. When i run adb devices command ,it returns me my device with serial code.
mine is real device.
this is the java code that i'm using:

JadbConnection jadb = new JadbConnection();
JadbDevice device = jadb.getAnyDevice();
System.out.println(device.getSerial());
System.out.println(device.getState());

@SKART1
Copy link
Collaborator

SKART1 commented Jan 28, 2017

Can you try jadb.getDevices(); istead?

What are the error? NullPointerException - or just empty output

@gdetra
Copy link
Author

gdetra commented Jan 28, 2017

null
Exception in thread "main" java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.(Unknown Source)
at java.net.Socket.(Unknown Source)
at se.vidstige.jadb.JadbConnection.createTransport(JadbConnection.java:25)
at se.vidstige.jadb.JadbDevice.getTransport(JadbDevice.java:28)
at se.vidstige.jadb.JadbDevice.getState(JadbDevice.java:44)
at DeviceClass.main(DeviceClass.java:19)

@gdetra
Copy link
Author

gdetra commented Jan 28, 2017

after adb start-server the exception is

null
Exception in thread "main" se.vidstige.jadb.JadbException: command failed: closed
at se.vidstige.jadb.Transport.verifyResponse(Transport.java:39)
at se.vidstige.jadb.JadbDevice.getState(JadbDevice.java:46)
at DeviceClass.main(DeviceClass.java:19)

@gdetra
Copy link
Author

gdetra commented Jan 28, 2017

any solutions?

@gdetra
Copy link
Author

gdetra commented Jan 28, 2017

With getDevices() now i can get serial number, but for state i have the same exception

@SKART1
Copy link
Collaborator

SKART1 commented Jan 30, 2017

Sorry I do not have windows host to test

You may try to debug actual response to determine what is the error

@vidstige
Copy link
Owner

Interesting. The getAnyDevice addresses devices in a different way if I recall correctly. What is your adb version?

@gdetra
Copy link
Author

gdetra commented Jan 30, 2017

1.0.32 (adb version)

@gdetra
Copy link
Author

gdetra commented Feb 2, 2017

@vidstige any solutions?

@vidstige
Copy link
Owner

vidstige commented Feb 3, 2017

@gdetra Alright, I've looked into this. I could not reproduce your problem with adb version 1.0.31 on Windows. Some question to help me troubleshoot this. I ran the RealDeviceTestCases.testListFilesTwice() test method and it works as expected. It calls the JadbConnection.getAnyDevice() method.

  • Are you using the maven package or do you have the source checked out. If you have the code checked out, can you please try to run the RealDeviceTestCases test suite?
  • What's your exact OS version?
  • What Android device(s) are you using to reproduce this?
  • Could you please try with adb 1.0.32 (just in case there is some protocol change in that version)

Thanks for your patience.

@gdetra
Copy link
Author

gdetra commented Feb 4, 2017

i'm using maven package. I use Windows 10 anniverasy update (Surface pro 4). My phone is a Xiaomi mi5.
i haven't trying with another device. i'm trying with testListFilesTwice()

@gdetra
Copy link
Author

gdetra commented Feb 5, 2017

@vidstige even with adb version 1.0.31 i have the same exception. How can i use realDeviceTestCases?

@vidstige
Copy link
Owner

vidstige commented Feb 6, 2017

Hmm, that worked for me. The device should not matter in this case. Very strange indeed. It works on my Windows machine as I wrote before. Some more things you could try to help me get more information on this:

  • Can you try with an emulator? How does that work?
  • Check the adb daemon log (somewhere on the device) for any errors during this exception.

@gdetra
Copy link
Author

gdetra commented Feb 9, 2017

i have tried with an emulator and the result is the same. Can you tell me , @vidstige , how can i get this log? i have tried in tmp folder but i haven't found nothing. Help me please!

@vidstige
Copy link
Owner

vidstige commented Feb 9, 2017

What version of jadb are you using? Can you try checking out latest master and see how it works there? Latest master works for me when I tested. As a workaround - Can't you just use jadb.getDevices()? What do you want to do?

  • The adb daemon log should be inside the regular logcat. E.g. try to run getAnyDevice and watch logcat output, note any errors and paste here.
  • Also try to run with latest master jadb as I have tested that and it works.

@SKART1
Copy link
Collaborator

SKART1 commented Feb 13, 2017

May be it is some firewall? Try to switch it at least for some time

May you try different PC/wire/phone?

@gdetra
Copy link
Author

gdetra commented Feb 20, 2017

@SKART1 i have tried but nothing to do. @vidstige i cannot find adb daemon log; if it is logcat i don't know how to show it.

@gdetra
Copy link
Author

gdetra commented Feb 20, 2017

@vidstige i have this version "number" because v1.1 give me cannot find error
94ebf38
I got it from here #14

@vidstige
Copy link
Owner

Alright, so you cannot use the latest version in JitPack? So what I mean is, can you please try to git clone this repository and run the test from there?

@SKART1
Copy link
Collaborator

SKART1 commented Feb 21, 2017

@vidstige
Latest version is v1.0.1 - see jitpack

As for your problem - may be java programs run`s isn some kind of sandbox in latest windows OS?
You may try to dump traffic between:

  • adb client + adb server
  • jadb + adb server

to compare them. You can do it with wireshark

But I am sure this should not be so difficult =(

@vidstige
Copy link
Owner

Closing this for now.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants