Connecting to a USB Android device in a Docker container via ADB

前端 未结 6 1057
鱼传尺愫
鱼传尺愫 2020-12-04 18:15

I have created a Docker image which contains the Android SDK and am trying to expose my Android phone in a container running this image. So I used the --privileged

6条回答
  •  一整个雨季
    2020-12-04 19:00

    Excuse me for offtop. But I cannot answer to this question so I write it down here.

    I am using ubuntu:18.04 and tried to connect my Samsung Galaxy A3 2016 and debug it with ADB. Devices was unauthorized and no dialog popped up on the screen!

    How I solved the problem:

    I was interested will the problem still occure inside a Docker container? The answer was "No!".

    1. Inside a Docker container, that I invoked with following: (this is the answer for this topic :) )

      docker run --name android-adb -it -d --privileged -v /dev/bus/usb:/dev/bus/usb ubuntu:16.04 bash
      
    2. I downloaded platform-tools (distribution with ADB). Added its path to environment. And restarted bash

    3. After restarting ADB server inside Docker container AND killing ADB server on host machine. I found out that confirmation dialog appeared on the smartphone's screen!

    So on the host machine the problem was in .android directory I think. Just move it to .android-backup. The next adb start-server command will create new one. Also I replaced platform-tools folder with most recent

提交回复
热议问题