Forum General

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Can't find my device on the devices list

NuclearWeaponNuclearWeapon Member ✭✭

I have connected my phone to computer and enable use debug mode, I can use "adb -devices" find my device, but in vistual studio, it's always blank in devices list. And I have check the xamarin diagnostic output, always show thses message again and again, start with "adb server started" then "connection refused", like a loop:

[W:]: Adb connection refused

Can someone give some advice about how to fix that, thanks!

Answers

  • XamarinProblemsXamarinProblems Member ✭✭✭

    @NuclearWeapon I'm guessing you are either using the wrong cable to connect your android to the PC or forgot to enable Developer on the device.

    https://www.howtogeek.com/129728/how-to-access-the-developer-options-menu-and-enable-usb-debugging-on-android-4.2/

  • NuclearWeaponNuclearWeapon Member ✭✭

    @XamarinProblems said:
    @NuclearWeapon I'm guessing you are either using the wrong cable to connect your android to the PC or forgot to enable Developer on the device.

    Hi, I am sure about that I have enable the debugging mode.

    And the log is like below:

    [D:]: $(MonoAndroidToolsDirectory) path C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android is valid
    [D:]: $(MonoAndroidBinDirectory) path C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android is valid
    [D:]: mscorlib.dll path C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0 is valid
    [D:]: GetSdkPath C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Version.txt exists=False
    [D:]: GetSdkPath C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Version exists=False
    [D:]: GetSdkPath C:\Program Files (x86)\Microsoft Visual Studio\Version.txt exists=False
    [D:]: GetSdkPath C:\Program Files (x86)\Microsoft Visual Studio\Version exists=False
    [D:]: GetSdkPath C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android\Version.txt exists=False
    [D:]: GetSdkPath C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android\Version exists=True
    [D:]: FindVersionFile: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android\Version, result=True
    [I:]: Found Xamarin.Android 10.3.1.4
    [I:sdk]: Runtime path: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android
    [I:sdk]: Framework path: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0
    [D:]: ValidateAndroidSdkLocation: C:\Program Files (x86)\Android\android-sdk, result=True
    [D:]: ValidateAndroidNdkLocation: ``, result=False
    [I:]: Looking for Android NDK...
    [I:]: Looking for Android SDK...
    [D:]: ValidateAndroidSdkLocation: C:\Program Files (x86)\Android\android-sdk, result=True
    [D:]: ValidateJavaSdkLocation: C:\Program Files\Android\Jdk\microsoft_dist_openjdk_1.8.0.25, result=True
    [I:]: Tracking android devices started
    [D:]: 已开始跟踪 avd
    [D:]: avd 观察程序 *.ini 路径:“C:\Users\name.android\avd”
    [D:]: avd 观察程序: 通过 0 设备从 avd 获取设备列表
    [W:]: Adb connection refused
    [I:]: Starting Adb server (adb start-server)
    [I:]: Looking for Android SDK...
    [D:]: ValidateAndroidSdkLocation: C:\Program Files (x86)\Android\android-sdk, result=True
    [I:]: Adb start-server operation completed
    [W:]: Adb connection refused
    [I:]: Starting Adb server (adb start-server)
    [I:]: Adb start-server operation completed
    [W:]: Adb connection refused
    [I:]: Starting Adb server (adb start-server)
    [I:]: Adb start-server operation completed
    [W:]: Adb connection refused
    [I:]: Starting Adb server (adb start-server)
    [I:]: Adb start-server operation completed
    [W:]: Adb connection refused
    [I:]: Starting Adb server (adb start-server)
    [I:]: Adb start-server operation completed
    [W:]: Adb connection refused
    [I:]: Starting Adb server (adb start-server)
    [I:]: Adb start-server operation completed
    [W:]: Adb connection refused
    [I:]: Starting Adb server (adb start-server)
    [I:]: Adb start-server operation completed
    [W:]: Adb connection refused
    [I:]: Starting Adb server (adb start-server)
    [I:]: Adb start-server operation completed
    [W:]: Adb connection refused
    [I:]: Starting Adb server (adb start-server)
    [I:]: Adb start-server operation completed
    [W:]: Adb connection refused
    [I:]: Starting Adb server (adb start-server)
    [I:]: Adb start-server operation completed
    [W:]: Adb connection refused
    [I:]: Starting Adb server (adb start-server)
    [I:]: Adb start-server operation completed
    [W:]: Adb connection refused
    [I:]: Starting Adb server (adb start-server)
    [I:]: Adb start-server operation completed

    I can see my device here in DDMS

  • XamarinProblemsXamarinProblems Member ✭✭✭
    edited July 2020

    @NuclearWeapon if you swipe down from the top you should see an icon showing you that your Android is charging power from USB, make sure you've allowed USB debugging there and that the connection isent locked to charge only will look something like this with the charging selected if wrong.

    And make sure to go into developer options and enable USB debugging, debug mode when USB is connected

  • NuclearWeaponNuclearWeapon Member ✭✭

    Hello, yes, it's show the debug mode in the task bar

  • XamarinProblemsXamarinProblems Member ✭✭✭
    edited July 2020

    @NuclearWeapon If Developer mode is <On>, debugging enabled, and the phone is connected with the correct cable to the PC running Visual studio then i dont know why you cant see the device.

    Perhaps check if you have the correct SDK's installed to build and deploy on your device.

    In visual studio go to Tools -> Android -> Android SDK Manager

    If this dosent work, then im out of ideas.

  • NuclearWeaponNuclearWeapon Member ✭✭

    @XamarinProblems said:
    @NuclearWeapon if you swipe down from the top you should see an icon showing you that your Android is charging power from USB, make sure you've allowed USB debugging there and that the connection isent locked to charge only will look something like this with the charging selected if wrong.

    And make sure to go into developer options and enable USB debugging, debug mode when USB is connected

    Hello thanks for reply, yes, it's show the debug mode in the task bar.

  • NuclearWeaponNuclearWeapon Member ✭✭

    @XamarinProblems
    It's working on my laptop but the desktop can't.
    Anyway, thanks for the information.

  • XamarinProblemsXamarinProblems Member ✭✭✭

    @NuclearWeapon my last guess if it works on laptop but not on desktop is that the USB port you are using from the desktop dosent support the debugging. Some front facing USB ports only support powering and basic communication. Unless already done, try connecting your phone directly to the motherboard, via. one of the back facing ports.

Sign In or Register to comment.