2

I am trying to build AnysoftKeyboard in Android studio. I have java 9(jdk 9) and the appropriate ndk (android-ndk-r14b), as the creator in GitHub says. I have also changed the local.properties file to shows to the correct paths. Nevertheless I am still getting some errors. You can find below those errors.

Run tasks error : org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':base:compileDebugJavaWithJavac

java compiler errors : Caused by: java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError: com/sun/tools/javac/util/JavacMessages$ResourceBundleHelper Caused by: java.lang.NoClassDefFoundError: com/sun/tools/javac/util/JavacMessages$ResourceBundleHelper Caused by: java.lang.ClassNotFoundException: com.sun.tools.javac.util.JavacMessages$ResourceBundleHelper

Here is a screenshot of the error : AnySoftKeyboard Compile Error , Run Tasks Error

The project uses gradle, in which I am not familiar with, so if I have missed any important step-point, please guide me to solve it.

Is there something that I am missing and getting these errors? What should I do? Thanks in advance.

ppel123
  • 83
  • 3
  • 10

2 Answers2

3

After following just the official documentation I successfully built a project. I think you just forget with setting JAVA_OPTS with adding java.se.* source as mentioned below. And that is why you have it in stacktrace error above, with missing java.se. resources.

To develop this project, you'll need:

  • Java 10 - get OpenJDK or AdoptOpenJDK.

  • Make sure you have the environment variable JAVA_OPTS='-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee'. This is required to ensure the JVM is merciful with libraries that were not designed for Java9+ JVMs.

  • git
  • Android Studio
  • Android SDK API Level 28 installed. Set up local.properties file to point to it (that is, ensure you have sdk.dir=/path/to/android/sdk in it).
  • Android NDK r14b installed. Set up local.properties file to point to it (that is, ensure you have ndk.dir=/path/to/android/ndk in it).
GensaGames
  • 5,538
  • 4
  • 24
  • 53
  • 1
    I have set the variable JAVA_OPTS (this is how it is in my system - JAVA_OPTS=-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee) I finally built it, but not from within Android Studio. I did it from cmd with gradle in project root. I think I faced some certificate errors, but eventually solved them ([link]https://stackoverflow.com/a/40743987 , [link]https://stackoverflow.com/a/36427118). The main problem I am facing is that I cannot change JDK in Android Studio (in order to use JDK 10). – ppel123 Nov 12 '19 at 21:56
  • @ParaskevasPetsanas You built it from `cmd`, because `JAVA_OPTS` need to set within build configuration tab inside Android Studio – GensaGames Nov 12 '19 at 23:12
  • I set it in Android Studio, but I am still getting errors. I think the problem is that I cannot change the android studio default jdk (please choose a valid jdk 8 directory). Do you have any advice ? – ppel123 Nov 17 '19 at 19:19
  • Ok, then in this case, you need to build project via console. – GensaGames Nov 17 '19 at 21:03
  • I tried by settings JAVA_HOME to AdoptOpenJDKversion and JAVA_OPTS in system variable when try to build from cmd its showing JAVA_HOME is set to an invalid directory. How to resolve that? – KIRAN CSN Dec 19 '19 at 07:19
  • @KIRANCSN if you are using linux. Make sure you have imported your variables (Java home and opts) into `.bash_profile` or `.profile` files. – GensaGames Dec 19 '19 at 17:07
  • @GensaGames thanks for replying. But i am using windows OS for building project – KIRAN CSN Dec 19 '19 at 17:17
  • @KIRANCSN If you are setting your local variables throw the Win UI, make sure the path is correct. You should point Java - to Java Bin location (not AdoptOpenJDKversion) – GensaGames Dec 19 '19 at 18:20
0

Caused by: java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError: com/sun/tools/javac/util/JavacMessages$ResourceBundleHelper

TO remove this error comment below line prone error.

Manthan Patel
  • 1,784
  • 19
  • 23