Debugging Android debugging



  • I got a brand new Huawei P30 phone to do development on.
    8 out of 10 times when I try to start a debugger on it, it doesn't start.

    Displayed at the Android Studio debugger console is this:

    $ adb shell cat /data/local/tmp/lldb-server | run-as com.companyname.appname sh -c 'cat > /data/data/com.companyname.appname/lldb/bin/lldb-server && chmod 700 /data/data/com.companyname.appname/lldb/bin/lldb-server'
    $ adb shell cat /data/local/tmp/start_lldb_server.sh | run-as com.companyname.appname sh -c 'cat > /data/data/com.companyname.appname/lldb/bin/start_lldb_server.sh && chmod 700 /data/data/com.companyname.appname/lldb/bin/start_lldb_server.sh'
    Starting LLDB server: /data/data/com.companyname.appname/lldb/bin/start_lldb_server.sh /data/data/com.companyname.appname/lldb unix-abstract /com.companyname.appname-0 platform-1587130520225.sock "lldb process:gdb-remote packets"
    

    and then nothing. What should I do? HAAAAAAALP



  • Sometimes, but not always, I get error messages in the Android Studio Event Log such as:

    2020. 04. 17.
    15:38	Unable to run 'adb': null
    
    15:38	'/Users/ME/Library/Android/sdk/platform-tools/adb start-server' failed -- run manually if necessary
    
    15:38	Gradle sync started
    
    15:39	Unable to run 'adb': null
    
    15:39	'/Users/ME/Library/Android/sdk/platform-tools/adb start-server' failed -- run manually if necessary
    
    15:39	Plugin Update Recommended: Android Gradle Plugin is ready to update.
    
    15:39	Gradle sync finished in 33 s 567 ms
    
    15:39	NDK Resolution Outcome: Gradle model version=5.6.4, NDK version=20.1.5948944
    
    15:39	* daemon not running; starting now at tcp:5037
    
    15:39	* daemon started successfully
    
    15:39	Unable to run 'adb': null
    
    15:39	'/Users/mmarczell/Library/Android/sdk/platform-tools/adb start-server' failed -- run manually if necessary
    
    15:40	* daemon not running; starting now at tcp:5037
    
    15:40	ADB server didn't ACK
    
    15:40	Full server startup log: /var/folders/4c/w1bj9h4d5_df436ckn8xxmqr0000gq/T//adb.503.log
    
    15:40	Server had pid: 20156
    
    15:40	--- adb starting (pid 20156) ---
    
    15:40	adb I 04-17 15:40:06 20156 347305 main.cpp:60] Android Debug Bridge version 1.0.41
    
    15:40	adb I 04-17 15:40:06 20156 347305 main.cpp:60] Version 29.0.6-6198805
    
    15:40	adb I 04-17 15:40:06 20156 347305 main.cpp:60] Installed as /Users/ME/Library/Android/sdk/platform-tools/adb
    
    15:40	adb I 04-17 15:40:06 20156 347305 main.cpp:60] 
    
    15:40	adb E 04-17 15:40:06 20156 347308 usb_osx.cpp:340] Could not open interface: e00002c5
    
    15:40	adb E 04-17 15:40:06 20156 347308 usb_osx.cpp:301] Could not find device interface
    
    15:40	adb E 04-17 15:40:06 20156 347308 usb_osx.cpp:340] Could not open interface: e00002c5
    
    15:40	adb E 04-17 15:40:06 20156 347308 usb_osx.cpp:301] Could not find device interface
    
    15:40	adb F 04-17 15:40:06 20156 347305 main.cpp:144] could not install *smartsocket* listener: Address already in use
    
    15:40	* failed to start daemon
    
    15:40	error: cannot connect to daemon
    
    15:40	* daemon not running; starting now at tcp:5037
    
    15:40	ADB server didn't ACK
    
    15:40	Full server startup log: /var/folders/4c/w1bj9h4d5_df436ckn8xxmqr0000gq/T//adb.503.log
    
    15:40	Server had pid: 20165
    
    15:40	--- adb starting (pid 20165) ---
    
    15:40	adb I 04-17 15:40:35 20165 347812 main.cpp:60] Android Debug Bridge version 1.0.41
    
    15:40	adb I 04-17 15:40:35 20165 347812 main.cpp:60] Version 29.0.6-6198805
    
    15:40	adb I 04-17 15:40:35 20165 347812 main.cpp:60] Installed as /Users/mmarczell/Library/Android/sdk/platform-tools/adb
    
    15:40	adb I 04-17 15:40:35 20165 347812 main.cpp:60] 
    
    15:40	adb E 04-17 15:40:35 20165 347815 usb_osx.cpp:340] Could not open interface: e00002c5
    
    15:40	adb E 04-17 15:40:35 20165 347815 usb_osx.cpp:301] Could not find device interface
    
    15:40	adb E 04-17 15:40:35 20165 347815 usb_osx.cpp:340] Could not open interface: e00002c5
    
    15:40	adb E 04-17 15:40:35 20165 347815 usb_osx.cpp:301] Could not find device interface
    
    15:40	adb F 04-17 15:40:35 20165 347812 main.cpp:144] could not install *smartsocket* listener: Address already in use
    
    15:40	* failed to start daemon
    
    15:40	error: cannot connect to daemon


  • A suspicious thing is that whenever I try to adb start-server or adb devices from the terminal, it might take several minutes.



  • Now I've narrowed down to the following:
    If I'm connected to the company VPN - which is of course required to access the source repo - I cannot do Android debugging. More precisely, even running adb start-server takes precisely 1 min 20 seconds. If I'm not connected to VPN, it runs instantly.


  • Java Dev

    @marczellm said in Debugging Android debugging:

    Now I've narrowed down to the following:
    If I'm connected to the company VPN - which is of course required to access the source repo - I cannot do Android debugging. More precisely, even running adb start-server takes precisely 1 min 20 seconds. If I'm not connected to VPN, it runs instantly.

    The VPN client roflstomps your routing table, meaning nothing not on the corporate network is reachable?



  • @PleegWat that'd be my guess, but I don't know much.



  • @PleegWat said in Debugging Android debugging:

    nothing not on the corporate network is reachable?

    That is incorrect, as I can still browse the web, as well as use other pieces of software that serve stuff on localhost.


  • Java Dev

    @marczellm The web routed through your own internet connection, or the web routed through corporate VPN?

    Localhost would still work since it's on corporate VPN, and while I suspect it's possible to break localhost routing, I'm not sure your linux desktop would still work.

    If you're on cisco anyconnect, try openconnect from your distribution's package manager.



  • @PleegWat said in Debugging Android debugging:

    linux desktop

    It's a mac

    @PleegWat said in Debugging Android debugging:

    cisco anyconnect

    It's a FortiClient


  • Java Dev

    @marczellm said in Debugging Android debugging:

    @PleegWat said in Debugging Android debugging:

    linux desktop

    It's a mac

    Close enough that it probably won't work with unconnectable localhost either.

    @PleegWat said in Debugging Android debugging:

    cisco anyconnect

    It's a FortiClient

    No specific experience for that one. It might be worth a try to look for open source alternatives which play nicer with your routing table. Do check your corporate policy, and remember in the end you not being able to do your job is your boss's problem.



  • @PleegWat said in Debugging Android debugging:

    you not being able to do your job is your boss's problem

    Already working with IT investigating this, they’re very helpful



  • @marczellm said in Debugging Android debugging:

    IT ... very helpful

    Do tell me more; I love a good fantasy.

    Filed under: Not intentionally QooC bait.


  • Discourse touched me in a no-no place

    @PleegWat said in Debugging Android debugging:

    The VPN client roflstomps your routing table, meaning nothing not on the corporate network is reachable?

    It's possible that it's the lesser cousin of that, where routes to the current host are getting routed off machine and that the server is not actually listening on localhost but rather on your actual hostname (because some idiots get that wrong). And corporate is saying “you aren't a server, so we will protect you”.

    Sounds like you need to find out what it is actually trying to do at the network connectivity level. Luckily, that's one of the easier things to probe.



  • Is this safe to do on a Mac?

    The warning in the /etc/hosts file saying don't change the localhost entry is scary enough.



  • also, it seems like adb is trying to start the server using ipv6 first, and the long timeout introduced by the vpn affects that. after 80 seconds it tries to start the server on ipv4 and that works. how can I disable ipv6 on the mac localhost? I only found how to disable it for real network interfaces.


  • Discourse touched me in a no-no place

    @marczellm said in Debugging Android debugging:

    Is this safe to do on a Mac?

    Yeah it's fine.

    @marczellm said in Debugging Android debugging:

    The warning in the /etc/hosts file saying don't change the localhost entry is scary enough.

    You could just add another entry for mapping the hostname.


Log in to reply