I need help to export APK

Godot Version

4.2.2

Question

Nice day. I’m getting the following error in Godot, I’ve already followed the documentation by installing JDK17 and Gradle, also Android Studio. The error disappears if I install JDK11 and configure the environment variables, but the APK that exports, exports it with errors (it loses *.so libraries) and I have to replace the JDK of the APK in Android Studio for it to work. Where am I failing? According to the documentation I should be running with JDK17 but I get that error and with JDK11 it exports, but I have to repair the APK.

Fixing the APK in Android Studio works fine on the phone, but as I said, it’s an extra step that I can surely save if they help me set everything up correctly.

Thank you very much for your help.

editor/export/editor_export_platform.h:182 - Exportar: La construcción del proyecto Android falló, comprueba la salida del error:

FAILURE: Build failed with an exception.

  • What went wrong:
    The supplied javaHome seems to be invalid. I cannot find the java executable. Tried location: C:\Program Files\Java\jdk-11\bin\java.exe

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org.

go to your system environment, set the new JDK 17 path, edit this C:\Program Files\Java\jdk-11\bin\java.exe to new JDK17 path

Hello! Thanks for replying, I already did that but there is still error, I attach screenshots.

Sorry for sending several messages, the system wouldn’t let me attach all the screenshots together.

it’s okay,
have you tried restart your godot and even your pc? it looks like the godot engine is still trying to use the old path

try this reply:

1 Like

Yes! This was the problem, thank you very much. I also had to do other things, to make everything fit with other engines I have: I installed Gradle 8.2 and configured the gradle.properties as follows:

org.gradle.jvmargs=-Xmx4g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

Once I checked that this was the problem, I eliminated the project template and installed it again (there was no need to edit the properties).

I also configured the minimum SDK in 29 and the objective at 30, and activate the V7 & V8 options.

Now I have the project correctly on the testing phone, an Moto e7i Power. My project involves videos, I verified that 1080p does not work in the mobile but on the PC. So I lowered the quality to 720p and now everything works correct. I think that the resolution could also be further lowered and even so it would look good.

By the way, I share how I made the videos, maybe someone serves:

-Download FFMPEG
-I configured the environment variable “Path” for the same
-And I used the following command in Powershell:

ffmpeg -i input.mp4 -vf “scale = -1: 720” -q: v 6 -q: a 6 output.ogv

Thank you very much for your help, now everything is already resolved.
Greetings!

1 Like

With Chatgpt’s help I did this script that facilitates the work of videos, attached and explanation as procedure.

1 | They open blog notes and hit this:

# Obtener la ruta del directorio donde se encuentra el script
$carpeta = $PSScriptRoot

# Obtener todos los archivos MP4 en la carpeta
$videos = Get-ChildItem -Path $carpeta -Filter "*.mp4"

# Recorrer cada video y convertirlo a OGV
foreach ($video in $videos) {
    # Construir el nombre del archivo de salida
    $nombreSalida = [System.IO.Path]::ChangeExtension($video.FullName, "ogv")
    
    # Comando de conversión con ffmpeg
    $comando = "ffmpeg -i `"$($video.FullName)`" -vf `"scale=-1:540`" -q:v 6 -q:a 6 `"$nombreSalida`""
    
    # Ejecutar el comando
    Invoke-Expression -Command $comando
}

2 | Save with extension .ps1

3 | Enable scripts execution in Powershell (execute PS as admin):

Set-ExecutionPolicy RemoteSigned

4 | They place the script in the folder that contains the videos and run with Powershell.

In the code, in the part that says: “Scale = -1: 540”
540 refers to half of 1080p

There you can place 720, 540, 1080, etc … The script what it does is take a video in 1920x1080 and keep the scale, reduce it to half (540p).

I hope it serves someone, it is what I can contribute for now.
Greetings!