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

Basic Android plugin causes exports to fail #76185

Closed
blurrred opened this issue Apr 17, 2023 · 8 comments
Closed

Basic Android plugin causes exports to fail #76185

blurrred opened this issue Apr 17, 2023 · 8 comments

Comments

@blurrred
Copy link

Godot version

4.0.2

System information

Manjaro Linux, Samsung Galaxy S8

Issue description

My custom Android plugins cause Android exports to fail with the error

  editor/export/editor_export_platform.h:173 - Export: Building of Android project failed, check output for the error. Alternatively visit docs.godotengine.org for Android build documentation.
  Cannot remove non-existent file or directory: $HOME/.cache/godot/tmpexport.1681767053.apk

For some reason, this only occurs with my own plugins. Ones other people have made that have even worked in Godot 3 still work in Godot 4, some with minor tweaking. My plugin worked just fine until I realized it wasn't being detected by Engine.get_singleton_list(). I tried making a bare-bones plugin and exports fail to launch with the aforementioned error upon enabling it.

Steps to reproduce

I followed FinePointCGI's tutorial on how to make an Android plugin along with the documentation, https://www.youtube.com/watch?v=kwf8SFfH4s8

Nothing is required in the engine aside from setting up Android exports and enabling the plugin.

Minimal reproduction project

N/A

@monstrum
Copy link

monstrum commented Jun 8, 2023

I got the same error on v4.0.3.stable.official.

on TUXEDO OS 2 based on Ubuntu 22.04

@blurrred do you find any solution?

Updates (same error) with no custom plugin, follows all steps on Documentation:

editor/export/editor_export_platform.h:173 - Export: Building of Android project failed, check output for the error. Alternatively visit docs.godotengine.org for Android build documentation.
  Cannot remove non-existent file or directory: $HOME/.cache/godot/tmpexport.1686596129.apk
  • Tested on Window
  • Tested on Ubuntu 22.04 unmodified

@Abab-bk
Copy link

Abab-bk commented Jun 24, 2023

I ran into the same problem and my solution was to change the project directory to full English.

@blurrred
Copy link
Author

@Abab-bk
What do you mean by project directory? I've only been using English this entire time.

@blurrred
Copy link
Author

@monstrum
Sorry, no solution yet. It's kind of taxing to keep doing the same process over and over again with no results while not getting any actual real work done.

@Abab-bk
Copy link

Abab-bk commented Jul 18, 2023

@monstrum Sorry, no solution yet. It's kind of taxing to keep doing the same process over and over again with no results while not getting any actual real work done.

@blurrred
I have now fixed all the issues with the Android plugin in the current version. The 173 error indicates that your Android plugin is not compliant, regardless of the reason. It could be a missing semicolon in your Java file, missing dependencies, etc. Anyway, it's difficult to pinpoint the exact cause. Android Studio may alert you about some unexpected errors during compilation.

@Abab-bk
Copy link

Abab-bk commented Jul 18, 2023

@blurrred
In summary, the cause of this error is the failure to compile. In fact, this is more like a Gradle issue.

@blurrred
Copy link
Author

blurrred commented Jul 18, 2023

@Abab-bk @monstrum
Thanks a ton for the info. I went through the video again and the issue that I was having was with the 'res' folder. Deleting it caused my plugin to (finally) start working again.

Closing this now.

@I194
Copy link

I194 commented Sep 22, 2023

For those encountering a similar issue, here's some additional information. Specifically, I was trying to run the official template Godot XR Template on Oculus Quest 2.

As @Abab-bk correctly pointed out, the problem lies in Gradle. At least in my case, all XR projects started to build (but not yet successfully launch!) as soon as I identified and corrected an incorrect Gradle setting. Here's how I did it:

  1. Checked the Gradle version in the automatically generated directory %your_project%/android/build by entering ./gradlew --version in the console within that directory. I found out that the Gradle version was 7.4.2.
  2. Next, I checked my Java version by entering java --version in the console. At that time, I was using Java version 20.
  3. I discovered that there is a compatibility table between Gradle and Java versions – Compatibility Table. It turned out that my version was only compatible with Gradle version 8 or higher. A global upgrade of Gradle yielded no results – you'll have to manually upgrade gradlew in each project you're interested in. So I chose to downgrade Java to version 17, which resolved the version incompatibility problem.

As I mentioned above, after these manipulations, all XR projects in Godot began to build and install on my Oculus Quest 2. However, they would launch for a couple of seconds and then crash. In the logs, there were two errors, one of which was: Attempt to open script 'res://components/persistent/persistent_config.gd' resulted in error 'File not found'. I checked, and indeed, this file was missing. I didn’t understand how to solve this problem, so I tried creating a new project and repeated the steps from the official documentation – Godot XR Deployment Guide. This worked – the project not only built and installed on Oculus Quest 2 but also launched and did not crash. I don't want to jump to conclusions, but I suspect the issue may lie in the project settings of Godot XR Template. Otherwise, I don't know how to explain why it didn't launch for me, but a clean project did.

Also, if you've launched the project on Oculus Quest and it doesn't crash but everything is black and it's impossible to interact with anything, you probably forgot to add a script to your Node3D where XROrigin3D is declared. Below is the basic code that allows you to get rid of the black screen and finally launch your project fully:

extends Node3D

# Called when the node enters the scene tree for the first time.
func _ready():
    var xr_interface: XRInterface = XRServer.find_interface('OpenXR')
    
    if xr_interface and xr_interface.is_initialized():
        var vp: Viewport = get_viewport()
        vp.use_xr = true

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
    pass

I hope this information helps you successfully launch your first VR project on Oculus Quest.


I will also add a few words about deleting certain directories in an attempt to solve the problem. Deleting res located in %your_project%/android/build did not help me at all, and neither did deleting the Gradle cache. Essentially, none of this should help you in such a situation. The only deletions that are sometimes necessary are to delete the android folder in your project directory. Godot itself will even require this from you if you try to install a new Android build template. I had to do this while I was experimenting with Gradle to somehow get the project to launch.

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

No branches or pull requests

5 participants