Not able to debug app on android device - Android Studio 2.0

后端 未结 12 1836
轻奢々
轻奢々 2020-12-09 14:48

I am not able to debug an app on my device (Asus Zenphone 2) after I updated android studio to 2.0. I keep seeing below message in debug tab right after I click on debug ico

12条回答
  •  悲&欢浪女
    2020-12-09 15:18

    Just throwing my experience in as this just started happening. With regards to all these answers, I tried a few of them and none seemed to work. So I started from scratch:

    Initial setup: - USB Debugging ENABLED - Always prompt when connecting to USB (I usually only connect in charge mode) - Allow ADB debugging in charge only mode ENABLED - Wait for debugger DISABLED - Verify apps over USB ENABLED

    The steps I took to get debugging back:

    • Close down Android Studio - I didn't go so far as to delete the .idea folder as discussed, but I'm sure it couldn't hurt.
    • DISABLE USB Debugging
    • Revoke USB debugging authorizations
    • Reconnect Device
    $ adb devices
    >  unauthorized
    
    • ENABLED USB Debugging
    • Reconnect Device
    • When prompted select ALLOW (I clicked always allow)
    $ adb devices
    >  device
    

    Open Android Studio and hit debug - Application started successfully, I was still getting 5-6 of these messages but then it worked:

    $ adb shell am start -n "com.exampleapp/com.exampleapp.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -D
    Waiting for application to come online: com.exampleapp.test | com.exampleapp
    Waiting for application to come online: com.exampleapp.test | com.exampleapp
    Waiting for application to come online: com.exampleapp.test | com.exampleapp
    Connecting to com.exampleapp
    Connected to the target VM, address: 'localhost:8600', transport: 'socket'
    

    React Native

    As a side note - this happens every so often, I'm not sure whether it's from switching back and forth between running from react-native run-android or debugging in Android Studio, but regardless I've had to do this a couple times (finally decided to document).

    Also remember

    $ adb reverse tcp:8081 tcp:8081
    

    and to start the packager when debugging (I tend to forget).

提交回复
热议问题