Search Unity

Question Correct way to debug/run from editor to android phone?

Discussion in 'Android' started by Lautaro-Arino, Dec 2, 2022.

  1. Lautaro-Arino

    Lautaro-Arino

    Joined:
    Sep 18, 2013
    Posts:
    93
    I cant get unity editor to test run on my android. I get this error:

    CommandInvokationFailure: Unity Remote requirements check failed C:\Program Files\Unity\Hub\Editor\2021.3.9f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\adb.exe forward tcp:7201 tcp:7201

    Im using Unity Remote 5 on the phones

    Ive tried 2 different android phones

    Ive tried 2 different projects. My own and a brand new Unity Mobile template.

    Ive enabled developer mode on the phones Ive enabled USDB debugging on the phones

    Ive tried disabling /renabling usb and developer mode

    Ive given the phones transfer files access

    The editor Unity Remote device setting in the unity project is set to Any Android Device If i go to Build Settings i can see my phone as selectable I can actually build and run and have the project start on the phone

    Ive also followed these instruction several times.

    stackoverflow.com/a/66345155

    Weird thing is I did get it to work earlier. I dont know how. I just tried the same thing as ive described in OP. Once it worked. Then it didnt. Then it started working again and i could swith the project on and off 2 times untill it just stopped working. After that it hasnt worked again.

    So i have been doing the same things about 60 times and about 4 of those worked. Can someone confirm that this is indeed the way android development in Unity is supposed to be done? So im not sitting trying to do something arcane that is no longer supported?
     
  2. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,920
    Can you manually execute:
    Code (CSharp):
    1. C:\Program Files\Unity\Hub\Editor\2021.3.9f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\adb.exe forward tcp:7201 tcp:7201
    2.  
    and see what it prints ?
     
  3. Lautaro-Arino

    Lautaro-Arino

    Joined:
    Sep 18, 2013
    Posts:
    93
    I get adb.exe: error: more than one device/emulator

    Im not trying to run the remote app anymore. Im building and opening on the phone and im trying to get debug info through catlog. But noting comes due to this error. When i run devices i can see my phone and emulator-5562 offline.

    Ive tried

    adb -s emulator-5562 emu kill

    returns:

    error: could not connect to TCP port 5562: cannot connect to 127.0.0.1:5562: No connection could be made because the target machine actively refused it. (10061)

    Ive also tried

    adb.exe -s R3CT20DP74P forward tcp:7201 tcp:7201

    which returns

    7201

    but does nothing else. Emulator is still there.
     
    Last edited: Dec 5, 2022
  4. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,920
    I can only guess Unity Remote code doesn't expect multiple devices to be connected, thus try quitting the emulator and leaving only physical device connected, before trying again.
     
  5. Lautaro-Arino

    Lautaro-Arino

    Joined:
    Sep 18, 2013
    Posts:
    93
    Ive tried several times by using the command adb kill-server but the emulator pops back. Ive also tried with the disconnect command. Then i get an error that it refuses to disconnect. Is this emulator from Unity? I dont know where else it could be from.
     
  6. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,920
    ADB doesn't control the emulator. The emulator comes from a tool called ADV or Device Manager (accessible via Android Studio), alternatively it can come as external application like bluestacks or Google Play Games for PC.
     
  7. Lautaro-Arino

    Lautaro-Arino

    Joined:
    Sep 18, 2013
    Posts:
    93
    I understand. Im new to this so im not sure what to do. I dont seem to have Android Studio installed and i cant find any ADV or device manager either. Ive been searching windows and especially same folder where ADB is found (The android SDK that comes with Unity).
     
  8. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,920
  9. Lautaro-Arino

    Lautaro-Arino

    Joined:
    Sep 18, 2013
    Posts:
    93
    Thanks! I actually already found that one yesterday and tried and its spot on! I could trace the origin of that emulator. Im a game music composer and have lots of Native instruments sound libraries and its one of them that created this zombie emulator! Totally unacceptable! I am going to write to them they need to change that. To anyone having this issue. The culprit is a service called NTKDaemon. You can kill it manually through the task manager. It will start when windows starts up. You can uninstall it following this threadd

    https://community.native-instrument...emon-it-appears-to-have-a-serious-memory-leak