Tag Archives: UE4 Android Package Error

[Solved] UE4 Android Package Error: cmd.exe failed with args

Edition:

UE4.27.2, Android Studio 4.0, Window system

Error content:

ERROR: cmd. exe failed with args /…….

Execution failed for task ‘:app:compileDebugJavaWithJavac’

> Compilation failed; see the compiler error output for details.

Solution:

This type of error reporting is general, JAVA-related error reporting, the red letter will only give cmd.exe failed with args, only search the line of error is unable to find the problem.

Error log to turn up, find * What went wrong:, the next two lines of the line is the real content of the error report.

In my personal case, the specific error is

Execution failed for task ‘:app:compileDebugJavaWithJavac’.

> Compilation failed; see the compiler error output for details.

The problem is caused by the inconsistency between the JDK version selected by UE4 and the JDK version in the system environment variable, either modify the JDK version selected by UE4 or modify the system environment variable.

The former: Edit->Project Settings->Android SDK->Location of JAVA, select the same JDK directory as your environment variable, and go to Edit->Project Settings->Android, you need to click Configure Now again.

The latter: open the system environment variables, find JAVA_HOME in the system variables, edit and modify it to the JDK version selected by UE4; find Path, double click to open it, find C:\Program Files (x86)\Common Files\Oracle\Java\javapath this line, copy the address, open it in the folder and delete the 3 JAVA files in it. Finally, open CMD and type java -version to test if the replacement has been completed.

[Solved] UE4 Android Package Error: failed for task :permission_library:compileDebugJavaWithJavac

Record ue4.27 Android packaging failure compileDebugJavaWithJavac

Enter the project folder G: \UE4_Project\MyProject\Intermediate\Android\arm64\gradle

Execute CMD  gradlew compileDebugJavaWithJavac

Solutions:

1. Add the red part to the .Build.cs of the project

2. Create extra file_UPL_.xml

3. Paste the following content into XML

<?xml version="1.0" encoding="utf-8"?>
<!-- XML -->
<root xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Gradle Properties -->
<gradleProperties>
<insert>
ANDROID_BUILD_TOOLS_GRADLE_VERSION=com.android.tools.build:gradle:3.5.3
</insert>
</gradleProperties>
</root>