Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

print() is no longer sent to Output panel when running project on Android due to debugger connection not working #82764

Closed
BastiaanOlij opened this issue Oct 4, 2023 · 15 comments

Comments

@BastiaanOlij
Copy link
Contributor

Godot version

4.2 dev f5696c3

System information

Android

Issue description

When running an Android application with "remote debug" ticked, Godot would always output print and error messages to the log in the Godot IDE.

We use this extensively in XR where alongside the "verbose" tickbox, we add a lot of extra information through print_verbose.
Even without that a standard Android project would atleast output the standard print lines (such as the "Godot Engine v4.1.1stable..." line).

So for instance running a simple XR project in Godot 4.1.1 stable with verbose enabled and remote debug enabled gives us:
image

Doing the same in master:
image

No more log. Same issue applies to normal Android. I have only tested this with gradle builds.

Steps to reproduce

Take a Godot project that can run on Android.

Enable remote debug

Run project on an Android device.

Minimal reproduction project

I think any simple project will do, but I used this for testing:
https://github.com/GodotVR/godot-xr-template

@Baryonics
Copy link

Same here. Here is the Output when running adb logcat. Maybe it helps somone to figure it out.

logcat

@akien-mga akien-mga added the bug label Oct 20, 2023
@Geometror
Copy link
Member

I just experienced this bug while doing some particle benchmarks on mobile. (no gradle build)
It's not only the print messages: it seems like the debugger wouldn't attach at all (so no profiling, pausing, stopping at breakpoints).

@Calinou Calinou changed the title Android - print is no longer sent to logs print() is no longer sent to Output panel when running project on Android due to debugger connection not working Oct 27, 2023
@m4gr3d
Copy link
Contributor

m4gr3d commented Oct 27, 2023

I just experienced this bug while doing some particle benchmarks on mobile. (no gradle build)
It's not only the print messages: it seems like the debugger wouldn't attach at all (so no profiling, pausing, stopping at breakpoints).

Thanks for the info! This actually gives me an insight into what the issue may be.

@akien-mga
Copy link
Member

I wonder if this would have been fixed by #84102? Worth checking in 4.2-beta4 when it's out.

@akien-mga
Copy link
Member

Seems to work fine for me on 4.2-beta5.

Note that I had to enable Deploy With Remote Debug manually, it seems to default to off.

@altamkp
Copy link

altamkp commented Dec 21, 2023

I am on 4.2 stable and the problem still exists, I am using gradle build and have turned on "Deploy With Remote Debug" already.

@patrykkalinowski
Copy link

This is an error from adb logcat on 4.2 stable:

USER ERROR: Script Debugger failed to connect, but being used anyway.
at: debug (core/debugger/remote_debugger.cpp:406)

@Ekaitzsegurola
Copy link

Ekaitzsegurola commented Dec 29, 2023

Same error here with 4.2.1, it was returning print messages and i was trying to make work OS.request_permissions (seems imposible). I tryied set "use gradle build" and since installation does not matter if i activate or not, it doesnt return any more print message

Pd: After restarting completely computer worked again android output messages.

@ArchLinus
Copy link

ArchLinus commented Dec 30, 2023

I have this same issue on 4.2.1. I notice when I start up the editor that it says that there is a failure to bind to port 6007.

  Cannot listen on port 6007, trying 6008 instead.
  Cannot listen on port 6008, trying 6009 instead.
  Cannot listen on port 6009, trying 6010 instead.

In the android export code (EditorExportPlatformAndroid::run) the port retrieved through:

int dbg_port = EDITOR_GET("network/debug/remote_port");

This doesn't account for retries if the editor fails to bind to 6007.

Workaround

Go to Editor Settings -> Network -> Debug and change Remote Port to the actual debug port. Before closing the editor switch it back to 6007.

@ArchLinus
Copy link

There might be some deeper underlying bug here. These ports remain open even after the editor is closed. I can't even find any process running with these PIDs.

image

image

Searching for the PID in process hacker, it seems that ADB is still running after the editor is closed?

image

@ernestofs1
Copy link

I have this same issue on 4.2.1. I notice when I start up the editor that it says that there is a failure to bind to port 6007.

  Cannot listen on port 6007, trying 6008 instead.
  Cannot listen on port 6008, trying 6009 instead.
  Cannot listen on port 6009, trying 6010 instead.

In the android export code (EditorExportPlatformAndroid::run) the port retrieved through:

int dbg_port = EDITOR_GET("network/debug/remote_port");

This doesn't account for retries if the editor fails to bind to 6007.

Workaround

Go to Editor Settings -> Network -> Debug and change Remote Port to the actual debug port. Before closing the editor switch it back to 6007.

Any one can explain what would the 'actual debug port' be?

@ArchLinus
Copy link

Any one can explain what would the 'actual debug port' be?

The actual debug port is the last port last port it attempts to connect to, so in my example log the actual debug port would be 6010.

@ernestofs1
Copy link

Any one can explain what would the 'actual debug port' be?

The actual debug port is the last port last port it attempts to connect to, so in my example log the actual debug port would be 6010.

Oh ok. I'm doing this on mac. Any idea where I can check for the last port it attempts to connect?

@Connor-McCloskey
Copy link

Still a problem in 4.2.2. All things Godot and Android, man...just a nightmare.

@Yolwoocle
Copy link

I'm losing my mind to this issue. This is still a problem in 4.3. Restarting my computer works in order to fix this, but only for a short while. It's getting excruciating at this point, I wonder if there's any workaround before I actually go insane.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests