1

I want to be able to create Android-Apps on my very old laptop. Since it can't run Android Studio I figured I could run it on my home computer and use RDS to access the PC with the laptop.

Now the problem was how to connect my Phone to my laptop and have it recognized by Android Studio on the PC. Since my laptop is in the same network as my PC (VPN) I managed to replicate this solution. I can run adb devices (since I've set the environment variable ANDROID_ADB_SERVER_ADDRESS I don't need the -H-flag) in the terminal and get my phone in the resulting list. However, when I try running the app in Android Studio no device is found.

So I am thinking that Android Studio uses an integrated ADB that ignores environment variables or some commands that don't support remote usage. Does anyone have an idea what I can do to have my Phone recognized by Android Studio and not just by adb on the PC? I don't want to manually load and start my apps every time I debug.

Emil S.
  • 412
  • 4
  • 20
  • No AS uses whatever adb is running. It's really, really hard to understand what you are doing. You don't say where you are running the adb commands. Using adb over the network requires two steps: 1) `adb tcpip ...` to put the phone into that mode, and then 2) `adb connect ...` from the host OS that wants to use adb on the phone. Each host OS that wants to connect to the phone over adb, over the network must do `adb connect...`. – Jeffrey Blattman Nov 06 '18 at 19:26
  • The phone itself is not running in network mode, it is connected via cable to the laptop. But the laptop is not running AS, the PC is. The linked question does a better job explaining the situation, the only difference is that my PC and my Laptop are connected through a VPN. On the laptop I run `adb -a -P nodaemon server` to allow remote adb instances to use the devices connected to the laptop. On the PC I then run `adb -H -P devices` and can retrieve the devices list of the laptop. – Emil S. Nov 06 '18 at 19:35
  • That sounds more complicated than what I said. You just need to connect your phone to your laptop and run `adb tcpip...` 1x, then you can `adb connect...` it from your machine running AS. – Jeffrey Blattman Nov 06 '18 at 19:42
  • Doesn't that require the phone to be in the same network as the machine that is running AS? Because that isn't the case here, only the laptop has a VPN into the network the PC is in. The PC is at home while the Laptop and the Device are remote. Enabling a VPN on the device isn't an option as it would interfere with the app I am writing. – Emil S. Nov 06 '18 at 19:48
  • Right... so differentiate the adb server and client. That env var and flags are for the client, not the server. AS has it's own client. You could try starting AS from the shell where you've set the var, or setting the value in your login script. Otherwise it seems you'd need to be able to muck with how AS uses the adb client. – Jeffrey Blattman Nov 06 '18 at 20:00
  • Okay, sorry for the initial confusion. I have set these flags for the client and as login vars. Since running `adb devices` works as intended and AS seems to use existing adb instances I'm expecting the "Select deployment target"-window to execute some command that doesn't work with the -H option. By now I have also noticed that the server gets killed when I try to run the app a second time. So start server -> try run on the client -> no devices -> try running on the client again -> server crashes (the log says `adb server killed by remote request`) – Emil S. Nov 06 '18 at 20:09

0 Answers0