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

后端 未结 12 1779
轻奢々
轻奢々 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:14

    Restarting Android Studios (2.1.1) resolved this for me.

    0 讨论(0)
  • 2020-12-09 15:16

    I had this problem in the Android emulator, and it was solved by going to Tools->AVD Manager, selecting the device, right click "Cold Boot Now".

    0 讨论(0)
  • 2020-12-09 15:17

    The solution which helped me is to click on attach the debugger to android Process and set debugger to java.

    0 讨论(0)
  • 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
    > <Device Id> unauthorized
    
    • ENABLED USB Debugging
    • Reconnect Device
    • When prompted select ALLOW (I clicked always allow)
    $ adb devices
    > <Device Id> 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).

    0 讨论(0)
  • 2020-12-09 15:22

    The problem is that after installing and starting to launch the app, that debugger client that AndroidStudio starts is unable to connect to the debugger server on the device. This can have many causes, see this answer and the other answer shown on this page and see if one solves the problem for you

    To help figure out the problem, look at the 'Console' tab of the 'Debugger' window in AS. One of the first few lines should look like this:

    $ adb shell am start -n "com.acme.audtest/com.acme.AudTest" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -D

    Cut and paste that line into a command prompt, REMOVE THE '-D', and execute it. It your app ('AudTest') comes up without error, the problem is in AS, is communication to the device, or the configuration of the device. If the app doesn't start, it is in the .apk. (Not the complete solution, but starts to point you in the right direction -- for which of the solutions below applies to your situation.)

    First I select the second option, and it worked fine. But then don't know why I change to select first option. So, the debugger shows the message Waiting for application to come online forever. And I did not notice that, just thought another app prevent me debug or that was an issue with Android Studio 2.0.

    So, just check to second option will solve my issue. Thank all.

    0 讨论(0)
  • 2020-12-09 15:22

    if you get this problem on the emulator, running adb reconnect worked for me. there is a similar command for devices adb reconnect device

    0 讨论(0)
提交回复
热议问题