Android Things: Connect to Raspberry Pi 3

99封情书 提交于 2020-01-09 02:43:07

问题


Total newbie, I have a Raspberry Pi and have put the Android Things disk image on and booted it up, but I can't connect to it from a Windows 10 PC running Android Studio, adb.exe via Ethernet or USB? The Pi screen has a green and grey "androidthings" logo, but says "Not Connected".

If I connect a USB cable and use the adb devices command, nothing is detected. If I connect an Ethernet cable and use adb connect android.local command it says unable to connect to android.local:5555?

I have tried two Pi's with the same result.


回答1:


The Pi screen has a green and grey "AndroidThings" logo but says "Not Connected".

The "Not Connected" message means your RPi3 is not in your local network, which most likely caused by directly connecting the RPi3 with your PC / laptop. What you should do is as follows.


Connect RPi3 to your router using Ethernet cable (1 in picture)

Reboot RPi3

in order to get the assigned IP address displayed.

Setup Wi-Fi settings

  • Connect to RPi3 via adb using the IP displayed:

    adb connect rpi3_ip_address
    
  • Setup Wi-fi settings as per the docs:

    adb shell am startservice -n com.google.wifisetup/.WifiSetupService -a WifiSetupService.Connect -e ssid network_SSID -e passphrase network_passcode
    

Connect to RPi3 over Wi-Fi (2 in picture)

    adb connect Android.local

Notes:

  • network_SSID and network_passcode are case sensitive,
  • remove -e passphrase network_passcode if your network doesn't have one

What if I have neither display nor Ethernet cable?

Connect to Serial Debug Console and setup Wi-Fi settings as above, just using am startservice etc... this time.


If I connect a USB cable and use the adb devices command, nothing is detected.

Micro USB of RPi isn't meant to transfer data over it: a credit goes to @Fabio's comment (don't forget to vote it up).




回答2:


If I connect a USB cable and use the adb devices command, nothing is detected.

  • AndroidThing device (Rpi3) will not connect through usb adb connection. see not connect to adb using USB. Either you have to connect it through network adb i.e through ethernet or following way

Another way of connect to wifi is using serial cable.Connect serial cable to RPis GPIO.(see this connect serial cable to RPi3) and obtain serial console.and give the following command on terminal.

>> su 
>>am startservice \
    -n com.google.wifisetup/.WifiSetupService \
    -a WifiSetupService.Connect \
    -e ssid <Network_SSID> \
    -e passphrase <Network_Passcode>


来源:https://stackoverflow.com/questions/41984034/android-things-connect-to-raspberry-pi-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!