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.
Read More:
- [Solved] UE4UE5 Package Android Error: UnrealBuildTool failed
- [Solved] UE4 Android Package Error: failed for task :permission_library:compileDebugJavaWithJavac
- How to Solve args = parser.parse_args() error
- [Solved] UE4 Error: Couldn‘t find file for package *** requested by async loading code. NameToLoad: ***
- UE4 Package Pico Project Error: error: ‘Resource‘ is a private member of ‘FOpenGLTextureBase‘
- [Solved] Unity Package Error: Failed running D:\Program Files\Unity2018.4.1\Editor\Data\il2cpp/build/il2cpp.exe
- [Solved] Android Compile and Package Error: Invalid keystore format
- [Solved] Android app development version update failed, Android – error: task execution failed ‘: app: com
- [Solved] error: package android.support.design.widget does not exist
- [Solved] UE4 Error: Serial loading Unknown structure
- Android Error: Android resource linking failed [How to Solve]
- Android Package Error: AAPT: error: IDAT: incorrect data check. AAPT: error: file failed to compile.
- [Solved] R Install XML package error: configuration failed for package ‘XML’
- [Solved] Installing github.com/uudashr/gopkgs/v2/cmd/gopkgs@latest FAILED和cannot install, GOBIN must be an ab
- [error record] Android application release package error handling (turn off syntax check log processing release configuration)
- ROS Error: Roslaunch got a ‘No such file or directory‘ error while attempting to run xterm -e gdb –args
- Android 10 open file exception open failed: eacces (permission denied) android:requestLegacyExternalStorage= “true“
- Android studio Error:Execution failed for task ‘: app:transformResourcesWithMergeJavaResForDebug ‘
- How to Solve UE5 Compile Error: Error MSB3073