godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.11k stars 21.18k forks source link

Android build issue - access to logs #80873

Closed BastiaanOlij closed 1 year ago

BastiaanOlij commented 1 year ago

Godot version

4.2 master 8e0346badefcd69656e1ae3ba12d6eaafd7a4fae

System information

Android - Windows editor

Issue description

The root cause may be an issue with building the XR loader plugin (https://github.com/godotvr/godot_openxr_loaders) but it highlights a usability problem when diagnosing Android export issues.

Exporting gives this cryptic error: image

Checking the log in the IDE gives us: image

The error given here, "cannot remove non-existent file or directory..." is a dud, this is just a result of the export failing. The real issue happens during the gradlew build and as the first error states "check output for the error", however Godot has closed the gradlew build window and there doesn't seem any (obvious) place to access this.

We need to either keep this window open on error and only close it on success, or we need to provide access to the last log somehow.

I ended up rerunning gradlew from the command line which gives me:

> Task :compileDebugJavaWithJavac FAILED
C:\Projects\godot-assets\godot_openxr_loaders\demo\android\build\src\com\godot\game\GodotApp.java:33: error: package org.godotengine.godot does not exist
import org.godotengine.godot.GodotActivity;
                            ^
C:\Projects\godot-assets\godot_openxr_loaders\demo\android\build\src\com\godot\game\GodotApp.java:41: error: cannot find symbol
public class GodotApp extends GodotActivity {
                              ^
  symbol: class GodotActivity
C:\Projects\godot-assets\godot_openxr_loaders\demo\android\build\src\com\godot\game\GodotApp.java:42: error: method does not override or implement a method from a supertype
        @Override
        ^
C:\Projects\godot-assets\godot_openxr_loaders\demo\android\build\src\com\godot\game\GodotApp.java:44: error: cannot find symbol
                setTheme(R.style.GodotAppMainTheme);
                ^
  symbol:   method setTheme(int)
  location: class GodotApp
C:\Projects\godot-assets\godot_openxr_loaders\demo\android\build\src\com\godot\game\GodotApp.java:45: error: cannot find symbol
                super.onCreate(savedInstanceState);
                ^
  symbol:   variable super
  location: class GodotApp
5 errors

These errors suggest an issue with the loader plugin configuration though I don't rule out an issue in the export on Godot itself.

Steps to reproduce

Minimal reproduction project

https://github.com/godotvr/godot_openxr_loaders

BastiaanOlij commented 1 year ago

cc @m4gr3d

BastiaanOlij commented 1 year ago

The build issue itself has been resolved, I managed to include devbuild=yes into my scons command as I had to re-setup vscode and managed to copy that from the editor build.

This meant the builds weren't included properly in the android_source.zip and things fell apart from there.

The original issue remains however that when a scenario like this happens, access to the logs that would help in diagnosing the issue isn't available. Changing the interface so the gradlew build log is not closed on failure would help heaps.

bruvzg commented 1 year ago

We need to either keep this window open on error and only close it on success

It should be already done, but seems like window hierarchy is structured in a such way (gradlew output window probably is child of process dialog) that case all the child windows to be closed when parent window is.

trysenga commented 1 year ago

Having issues with this as well. Build fails, who knows why. The logs either need to be captured to a file or the window needs to remain open.

dibely commented 1 year ago

+1 for somehow keeping the gradle build log window open or piping this info into the editor console log if possible to help with determining the real cause for why an Android build fails without having to manually build the project.