0

Can I connect to an Android device for the first time with python adb, in USB debug mode, without having to manually allow the connection?

This is my code from python adb library:

signer = sign_cryptography.CryptographySigner(
            op.expanduser('~/.android/adbkey'))
        # Connect to the device
        device = adb_commands.AdbCommands()
        device.ConnectDevice(port_path=None, serial=deviceIP, rsa_keys=[signer])

When I call this piece of code, it opens the pop up message with "Allow USB debugging ..." on the device. Is there a way to go around this pop up?

2

This popup is there for security reasons and can't be bypassed without system manipulation (root required).

Without that dialog an Android device would be once the user activated ADB wide open to anyone who connects to the device via USB. Therefore since Android 4.2 if I remember correctly Google added the RSA based authentication on ADB level to avoid unauthorized data access via ADB.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.