Unity remote debugging to android is not working - android

Im quite new to mobile development and im having a hard time getting the debugging on the phone to work. This is the error message i get
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

Related

Unable to attach debugger in Android Studio in MacBook

I am unable to attach debugger in Android Studio in MacBook. I am getting this error
Failed to start monitoring <deviceID>
I have tried multiple solutions :
Turn on/off usb debugging on device
Invalidate cache/restart Android Studio & Build -> Clean project
Stop and start adb server from terminal
Changing cable/usb port
Reboot Android device, Mac
Reset Android device
Upgrade gradle plugin & Android Studio to new version
Setup:
Macbook,
Android Studio 4.2,
Pixel 3a Android 11
OnDevice USB Preferences:
USB Controlled by: This Device
Use USB For: No Data transfer
I was able to work with the debugger fine for a very long time (~8 months) but it stopped abruptly few days ago and did not have any luck since then.
I have tried various solutions from stackoverflow, medium most of them fall under the things I have tried above and I have observed that the solutions are for Windows machines, so wondering if there is anything different for Android Studio on Macbook?
Appreciate your time looking into this. Thanks in advance.

Do unity remote work with android device without switching project platform to andriod

I am trying from last several hours to play unity remote device on Samsung glaxy device but unable to do it. I have confirm all the steps:
opened the Editor Settings in Unity (menu: Edit > Project Settings >
Editor) and select the device to use from the Unity Remote section.
but i didn't switch my platform to android(I don't want it ever cause i only want to test touch which will run on windows touch screen). So which thing i am missing to play remote? is this mandatory to switch platform on Android before using unity remote.
No, it is not required to switch platform to Android.
Unity Remote on Android Device works even if your Platform on Unity Editor is PC, Mac & Standalone. But, sometimes it is confusing. Here are some steps you shouldn't miss.
First make sure you have Android SDK installed on your PC. Here's the docs describing that.
On Unity, Go to Edit > Project Settings > Editor and under Unity Remote make sure Device is selected to Any Android Device, and Joystick Source is Remote.
Now, you'll have to restart the Unity Editor, but wait, before you start Unity, connect your Android Device to your machine and start Unity Remote App on the Android Device. Make sure USB Debugging is enabled on your Device.
Now, after your device is connected to PC and Unity Remote App is running on the Android Device, start Unity Editor and open your project.
Click Play and you should see the app playing on your android device too.
Sometimes, you might need to redo it when it does not work on first run.

Android device doesn't show up as target of Unity3d debugging

First of all, I'm positive that I've followed all steps in the Attaching MonoDevelop Debugger To An Android Device guide correctly (most importantly: having "Development Build" and "Script Debugging" enabled in the Build Settings).
When building & running a Unity Android app, however, my device (Samsung Galaxy S5, Android 6.0.1) just doesn't show up as a possible debug target in neither MonoDevelop, nor Visual Studio. For instance in Visual Studio, after clicking on Debug -> Attach Unity Debugger, in the "Select Unity Instance" window that opens I only see the Unity3d editor (Machine: local machine, Type: Editor). Debugging a Unity project that is run in the Unity Editor works fine, only debugging a project run on the physical android device doesn't work. It's the same for MonoDevelop.
I see the device as connected and online when doing
adb devices
I can also call adb shell commands (such as ls) on that device via command line. When I open Android Studio, I also see the device as a target for Logcat and even the just mentioned Unity Android app as a debuggable process (and when selecting it, all the correct logs that are expected from the running app).
I think it's safe to rule out a fault on the debugger side, because I tried
two different developer machines (both Windows 10 with current updates and without firewalls),
two different networks (home & university)
MonoDevelop, Visual Studio Community 2015, Visual Studio Professional 2017 RC (with respective Tools for Unity),
re-installing Unity3d,
different Unity3d projects (standard example project as well as own minimal example consisting of just a Text and a Button),
manually adding android:debuggable="true" to the project's AndroidManifest and
in Visual Studio manually connecting the debugger to the device via deviceip:5555 (in the "Select Unity Instance" Window -> Input IP).
On the device, I tried to
turning the phone off and on again,
turn USB debugging off & on,
selecting the Unity App as the "debug app" (in Developer options) and enabling/disabling "Wait for debugger" (also Developer options),
connecting the device via USB cable or via adb connect deviceip:5555 and
rooting the phone.
I don't know what else to try. I'm pretty sure it's something on the device. It has worked before, however I don't know what changed since then. Any tips are appreciated.
EDIT
Ok so I got some progress. When I examined the logcat output from the app, I found lines such as
Waiting for connection from host on [192.168.2.110:55416]...
(.2.110 being the IP of the device)
So I manually entered that IP & Port in Visual Studio in "Select Unity Instance" Window -> Input IP and right after that, the logcat read
PlayerConnection accepted from [192.168.2.115] handle:0x1c
(.2.115 being my developer machine)
So the connection is there. Visual Studio just doesn't "recognize" (?) it and doesn't switch to debugging mode so it can stop at breakpoints. Does anyone have an idea how I can force it to do so?
Well, not really an answer but I've found a way to debug it after all. Amidst all the logcat output, I've also found that line:
Using monoOptions --debugger-agent=transport=dt_socket,embedding=1,defer=y,address=0.0.0.0:56785
Taking that port (and the actual device IP) and entering it in Visual Studio in the "Select Unity Instance" Window -> Input IP, the debugger finally connected.
The problem is, that port gets changed every time the app is run so in order to debug it, I'll always have to look it up. Also (that may be a different issue altogether), the output of Debug.Log or Console.WriteLine isn't caught by the debugger. The only way to read the log for now is in AndroidStudio.
So yeah, the question still stands, how come the device doesn't show up as AndroidPlayer in the Select Unity Instance Window in Visual Studio (or according place in MonoDevelop)?
It does show up if your Android device is connected to wifi. When the app starts playing, you can see it in the "Select Unity Instance" box and then you can select it.

Invalid "--android-sdk" value "C:\android-sdk-win" in Titanium while deploying app on android mobile

I'm working on Titanium with alloy framework and quit new in it. I have develop some simple apps and these are working fine on my laptop's browser.Now i want to test it on my android mobile but unable to deploy it on my device. I've installed device driver on system and connected device on debugging mode but when i try to run as android device in titanium , i get Invalid "--android-sdk" value "C:\android-sdk-win" error. while ni case of native android apps (with java/eclipse) my device is working fine and I'm able to test my apps on my mobile in debugging mode. Don't know what is the problem with Titanium. I've searched internet for this problem but couldn't find any good solution. Any help will be highly appreciated.
I guess you don't have any SDK in "C:\android-sdk-win".
You should ensure you have the correct Android SDK/NDK paths configured in Titanium:Preferences:Studio:Platforms:Android.

Unity3D Android Device Suddenly Not Found (Was working before)

I have been making a 2D game using Unity3D and have been debugging it using a Huawei G510-0200 and a Samsung Galaxy S3. Everything was going fine and dandy, I then took a break for a couple of weeks, come back and find that neither of my phones are being found when I try to build the game onto them.
They were building just fine before, so I have NO IDEA what's going on.
Things I have tried:
USB Debugging is on
Restarted both devices and my Mac (which is running the Unity3D)
Reinstalled the SDK
Retraced my steps and routing the SDK in Unity Preferences
Updated Drivers
Tried all the different USB ports.
Any ideas?
I solved this problem by uninstalling Bluestack's player, which was conflicting with my developer environment, somehow i don't understand what was the issue with blustack's emulator. but surely it was making trouble.
Solution: if you have bluestack installed or some other android emulation software then uninstall it.
RESTART your system
Play the scene in editor with connected to device remote running on it.
After reading the Android section of this: http://docs.unity3d.com/Manual/Profiler.html
I figured out that debugging via usb is only possible if the device has an IP. I could see the device via adb devices command but it wouldn't work in Unity, once it had an IP, everything was just fine.

Categories

Resources