godotengine / godotengine/godot

Export Android: Godot fails to build an APK file but then it builds successfully.

Open
#98,486 4 comments 0 reactions 0 assignees View on GitHub
needs testing platform:android topic:buildsystem
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

Godot 4.3 official release.

### System information

Windows 11, Godot 4.3.

### Issue description

Here is my projeect:
[capybara_math_test.zip](https://github.com/user-attachments/files/17504599/capybara_math_test.zip)

I've recorded a video about the bug (export to android):
[BugVideo.zip](https://github.com/user-attachments/files/17504470/BugVideo.zip)

Problem Description:
I've found that if I build an APK file with UseGradle=off the APK file will be corrupted/damaged and failed to build. Then if I set UseGradle=on and build again the APK file still will be corrupted. Then if I set back UseGradle=off and build again the APK file will be built successfully! A very strange bug.

My setup:
Java SDK 23.0.1
Android Studio 2024

### Steps to reproduce

1 Download Java SDK 23 https://download.oracle.com/java/23/latest/jdk-23_windows-x64_bin.zip
2 Install Android Studio 2024 https://developer.android.com/studio
3 Install Android Packages. Tools ->SDKManager.
![image](https://github.com/user-attachments/assets/c585e8ec-7234-451e-a1ad-c6ceb94cb1cb)

4 Open my Godot project
[capybara_math_test.zip](https://github.com/user-attachments/files/17504599/capybara_math_test.zip)

5 Fix paths of AndroidSDK and JavaSDK
![image](https://github.com/user-attachments/assets/fae3355b-eaa1-4928-9223-bcbcbe26fd10)

6 Build a project with Gradle=off
![image](https://github.com/user-attachments/assets/5f7f9326-8bb3-4102-bb3f-44f8fea8bb0d)

You will see this notification. The build fails and The APK file will be corrupted/broken.
![image](https://github.com/user-attachments/assets/b4ffa3c3-8002-4a77-8bb2-89210f246280)

7 Install Build Temlate:
![image](https://github.com/user-attachments/assets/d3e30699-2356-40cc-b36b-7dd1b8357b98)

8 Try to build again with Gradle=on
![image](https://github.com/user-attachments/assets/195b16da-ea03-4a08-9c52-7f68298aeaae)

The build fails. You will see this notification.
![image](https://github.com/user-attachments/assets/e8dda702-92b3-44c9-80e5-8b11259464c4)

9 Try to build again with Gradle=off.
![image](https://github.com/user-attachments/assets/5f7f9326-8bb3-4102-bb3f-44f8fea8bb0d)

The build will succeed and there will be no any warnings!!!
The build will succeed and there will be no any warnings!!!
The build will succeed and there will be no any warnings!!!

### Minimal reproduction project (MRP)

Here is my projeect:
[capybara_math_test.zip](https://github.com/user-attachments/files/17504599/capybara_math_test.zip)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.