Enable ADB Debugging Before Connect

发布于:2025-07-09 ⋅ 阅读:(20) ⋅ 点赞:(0)

If you don’t enable Developer Options and turn on USB Debugging before plugging in the cable, adb devices won’t detect the phone because the Android system doesn’t trust the connection yet.

Here’s what you need to do step-by-step to fix this:


1. Enable Developer Options

  • Go to Settings > About phone.
  • Tap Build number 7 times quickly until you see “You are now a developer”.
  • Go back to Settings, there should now be a new menu called Developer options.

2. Enable USB Debugging

  • Open Settings > Developer options.

  • Scroll down and toggle ON:

    • USB Debugging
    • (Optional but useful) Allow USB debugging in charge only mode (if your Android version supports it).

3. (Optional but smart) Enable Always allow USB Debugging

  • When you first connect to the PC, your phone will show a pop-up:
    “Allow USB debugging?”
    Check Always allow from this computer and tap Allow.

4. (Extra precaution) Set USB mode to File Transfer (MTP)
Sometimes, the default USB mode is “Charging only” which doesn’t activate ADB. After plugging in:

  • Pull down the notification shade.
  • Tap the USB connection notification.
  • Set it to File Transfer (MTP).

💡 Why adb devices shows nothing?

  • Without enabling USB Debugging, Android ignores adb.
  • Some phones need you to manually set USB mode from “Charging” to “MTP”.
  • Bad USB cables (some are power-only, no data) also cause this.

There is a “backdoor” way to enable USB debugging without going through the Android UI, and it’s only possible in some cases (depends on whether your bootloader is unlocked and/or if you have custom recovery like TWRP). Here’s the full breakdown:


🛠️ Force-enable USB debugging via recovery/fastboot

This works by modifying the system settings that control USB debugging.


Step 1: Boot into recovery or fastboot

  • Recovery mode:

    • Power off your phone.
    • Hold Power + Volume Up (or Power + Volume Down, depends on phone) until you see the recovery screen.
    • If you have TWRP, even better.
  • Fastboot mode:

    • Power off the phone.
    • Hold Power + Volume Down to enter fastboot.

Step 2: Check if bootloader is unlocked
Run on your PC:

fastboot devices

If your device shows up, your connection works.

Then check:

fastboot oem device-info

If Bootloader unlocked: true, you’re good to go.
If locked, you can’t write to system partitions, unless the OEM allows unlocking (e.g., Xiaomi requires permission).


Step 3: Mount /system and edit settings (if using TWRP)
If you have TWRP:

  1. Go to Mount, and make sure System is mounted read/write.

  2. Open Advanced > Terminal or use adb shell.

  3. Use this command to enable USB debugging:

    setprop persist.service.adb.enable 1
    setprop persist.service.debuggable 1
    setprop persist.sys.usb.config adb
    
  4. You may also directly edit build.prop:

    nano /system/build.prop
    

    Add these lines at the end:

    persist.service.adb.enable=1
    persist.service.debuggable=1
    persist.sys.usb.config=adb
    
  5. Reboot system.


Step 4: Enable adb over TCP (optional)
If USB is flaky, you can force ADB over Wi-Fi:

adb tcpip 5555

Then connect via:

adb connect <phone_ip>:5555

⚠️ If you only have fastboot

You can try flashing userdata or system partition with a modified image that already has USB debugging enabled. For example:

  1. Download your stock ROM and unpack system.img.

  2. Mount system.img on your PC and edit build.prop like above.

  3. Repack and flash:

    fastboot flash system system.img
    
  4. Reboot to system.


This won’t work if…

  • Bootloader is locked (can’t modify system).
  • No TWRP installed.
  • OEM doesn’t allow fastboot flashing without authorization.

$ adb devices

  • daemon not running; starting now at tcp:5037
  • daemon started successfully
    List of devices attached

$ adb devices
List of devices attached
???RTHW device

$ adb shell pm uninstall --user 0 com.android.vending
Success

$ adb push "com.._1.2025.119-2511909_2arch_7dpi_25lang_8cf86cdc1278654ec74918d40043a804_apkmirror.com.apkm" /sdcard/Download/
com.
.**_1.2025.119-2511909_2arch_7dpi_25lang_8c…le pushed, 0 skipped. 14.2 MB/s (38778457 bytes in 2.610s)

This will copy it to
Internal Storage > Download


网站公告

今日签到

点亮在社区的每一天
去签到