Execution failed for task :'compileDebugJavawithJavaC'

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By utkarsh4517

My system-
Linux - Ubuntu
Using Android SDK and command line tools only.
Android Studio is too heavy for my system.
I initially used SDK v30 and all that, but got license acceptance issue. Therefore, I am using v29.
Oracle JDK 11.

Godot Custom build output

To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/6.7.1/userguide/gradle_daemon.html.

Daemon will be stopped at the end of the build stopping after processing
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01

Task :clean
Task :assetPacks:installTime:clean UP-TO-DATE
Task :preBuild UP-TO-DATE
Task :preDebugBuild UP-TO-DATE
Task :compileDebugAidl NO-SOURCE
Task :compileDebugRenderscript NO-SOURCE
Task :generateDebugBuildConfig
Task :generateDebugResValues
Task :generateDebugResources
Task :createDebugCompatibleScreenManifests
Task :extractDeepLinksDebug
Task :processDebugManifest
Task :mergeDebugShaders
Task :compileDebugShaders NO-SOURCE
Task :generateDebugAssets UP-TO-DATE
Task :mergeDebugAssets
Task :processDebugJavaRes NO-SOURCE
Task :mergeDebugResources
Task :processDebugResources
Task :checkDebugDuplicateClasses
Task :javaPreCompileDebug

Task :compileDebugJavaWithJavac
/home/utkarsh4517/Personal/Godot projects/Lets roll/project/android/build/src/com/godot/game/GodotApp.java:35: error: package android.os does not exist
import android.os.Bundle;
^
/home/utkarsh4517/Personal/Godot projects/Lets roll/project/android/build/src/com/godot/game/GodotApp.java:41: error: cannot access Activity
public class GodotApp extends FullScreenGodotApp {
^
class file for android.app.Activity not found
/home/utkarsh4517/Personal/Godot projects/Lets roll/project/android/build/src/com/godot/game/GodotApp.java:43: error: cannot find symbol
public void onCreate(Bundle savedInstanceState) {
^
symbol: class Bundle
location: class GodotApp
/home/utkarsh4517/Personal/Godot projects/Lets roll/project/android/GodotFAN/src/GodotFAN.java:7: error: package android.content does not exist
import android.content.Intent;
^
/home/utkarsh4517/Personal/Godot projects/Lets roll/project/android/GodotFAN/src/GodotFAN.java:8: error: package android.content does not exist
import android.content.Context;
^
/home/utkarsh4517/Personal/Godot projects/Lets roll/project/android/GodotFAN/src/GodotFAN.java:9: error: package android.util does not exist
import android.util.Log;
^
/home/utkarsh4517/Personal/Godot projects/Lets roll/project/android/GodotFAN/src/GodotFAN.java:10: error: package android.widget does not exist
import android.widget.FrameLayout;
^
/home/utkarsh4517/Personal/Godot projects/Lets roll/project/android/GodotFAN/src/GodotFAN.java:11: error: package android.widget does not exist
import android.widget.LinearLayout;
^
/home/utkarsh4517/Personal/Godot projects/Lets roll/project/android/GodotFAN/src/GodotFAN.java:12: error: package android.view does not exist
import android.view.Gravity;
^
/home/utkarsh4517/Personal/Godot projects/Lets roll/project/android/GodotFAN/src/GodotFAN.java:13: error: package android.view does not exist
import android.view.View;
^
/home/utkarsh4517/Personal/Godot projects/Lets roll/project/android/GodotFAN/src/GodotFAN.java:15: error: package javax.microedition.khronos.opengles does not exist
import javax.microedition.khronos.opengles.GL10;
^
/home/utkarsh4517/Personal/Godot projects/Lets roll/project/android/GodotFAN/src/GodotFAN.java:20: error: cannot access SensorEventListener
public class GodotFAN extends Godot.SingletonBase {
^
class file for android.hardware.SensorEventListener not found
12 errors

Task :compileDebugJavaWithJavac FAILED
Task :mergeDebugJavaResource

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:compileDebugJavaWithJavac’.

Compilation failed; see the compiler error output for details.

  • 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use ‘–warning-mode all’ to show the individual deprecation warnings.
See Command-Line Interface

BUILD FAILED in 32s
15 actionable tasks: 14 executed, 1 up-to-date

Exit Code: 1

gradlew Terminal output

utkarsh4517@utkarsh4517-HP-G42-Notebook-PC:~/Personal/Godot projects/Lets roll/project/android/build$ ./gradlew --info
Initialized native services in: /home/utkarsh4517/.gradle/native
To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: The Gradle Daemon.
Starting process ‘Gradle build daemon’. Working directory: /home/utkarsh4517/.gradle/daemon/6.7.1 Command: /usr/lib/jvm/java-11-openjdk-amd64/bin/java --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED -Xmx1024m -Dfile.encoding=UTF-8 -Duser.country=IN -Duser.language=en -Duser.variant -cp /home/utkarsh4517/.gradle/wrapper/dists/gradle-6.7.1-bin/bwlcbys1h7rz3272sye1xwiv6/gradle-6.7.1/lib/gradle-launcher-6.7.1.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 6.7.1
Successfully started process ‘Gradle build daemon’
An attempt to start the daemon took 2.003 secs.
The client will now receive all logging from the daemon (pid: 41425). The daemon log file: /home/utkarsh4517/.gradle/daemon/6.7.1/daemon-41425.out.log
Daemon will be stopped at the end of the build stopping after processing
Using 4 worker leases.
Watching the file system is disabled
Starting Build
Settings evaluated using settings file ‘/home/utkarsh4517/Personal/Godot projects/Lets roll/project/android/build/settings.gradle’.
Projects loaded. Root project using build file ‘/home/utkarsh4517/Personal/Godot projects/Lets roll/project/android/build/build.gradle’.
Included projects: [root project ‘build’, project ‘:assetPacks’, project ‘:assetPacks:installTime’]

Configure project :
Evaluating root project ‘build’ using build file ‘/home/utkarsh4517/Personal/Godot projects/Lets roll/project/android/build/build.gradle’.
Creating configuration androidTestUtil

Configure project :assetPacks
Evaluating project ‘:assetPacks’ using build file ‘/home/utkarsh4517/Personal/Godot projects/Lets roll/project/android/build/assetPacks/build.gradle’.

Configure project :assetPacks:installTime
Evaluating project ‘:assetPacks:installTime’ using build file ‘/home/utkarsh4517/Personal/Godot projects/Lets roll/project/android/build/assetPacks/installTime/build.gradle’.
All projects evaluated.
Analytics other plugin to proto: Unknown plugin type org.gradle.api.plugins.JvmEcosystemPlugin expected enum ORG_GRADLE_API_PLUGINS_JVMECOSYSTEMPLUGIN
Analytics other plugin to proto: Unknown plugin type org.gradle.api.plugins.JavaBasePlugin$Inject expected enum ORG_GRADLE_API_PLUGINS_JAVABASEPLUGIN$INJECT
Analytics other plugin to proto: Unknown plugin type com.android.build.gradle.internal.plugins.AssetPackPlugin expected enum COM_ANDROID_BUILD_GRADLE_INTERNAL_PLUGINS_ASSETPACKPLUGIN
Analytics other plugin to proto: Unknown plugin type com.android.build.gradle.AssetPackPlugin expected enum COM_ANDROID_BUILD_GRADLE_ASSETPACKPLUGIN
No tasks specified. Using default task ‘help’
Selected primary task ‘help’ from project :
Tasks to be executed: [task ‘:help’]
Tasks that were excluded:
:help (Thread[Execution worker for ‘:’,5,main]) started.

Task :help
Task :help in build Starting
Caching disabled for task ‘:help’ because:
Build cache is disabled
Task ‘:help’ is not up-to-date because:
Task has not declared any outputs despite executing actions.

Welcome to Gradle 6.7.1.

To run a build, run gradlew …

To see a list of available tasks, run gradlew tasks

To see a list of command-line options, run gradlew --help

To see more detail about a task, run gradlew help --task

For troubleshooting, visit https://help.gradle.org
Task :help in build Finished
:help (Thread[Execution worker for ‘:’,5,main]) completed. Took 0.236 secs.

BUILD SUCCESSFUL in 13s
1 actionable task: 1 executed

I am not able to understand this, If the gradle is working fine and the build is successful then why godot is showing error? should I downgrade the openjdk from 11 to 8?

did you solve the problem? …if so, can you tell me too

gege | 2022-01-26 00:16

I reinstalled the Android SDK completely, installed java jre instead of openjdk.

utkarsh4517 | 2022-01-26 13:39