This works only partially. It fails with a different error message:
FAILURE: Build failed with an exception.
* What went wrong:
java.lang.ExceptionInInitializerError (no error message)
* Try:
Run with --info or --debug option to get more log output.
* Exception is:
java.lang.ExceptionInInitializerError
at org.gradle.initialization.DefaultClassLoaderRegistry.restrictTo(DefaultClassLoaderRegistry.java:40)
at org.gradle.initialization.DefaultClassLoaderRegistry.restrictToGradleApi(DefaultClassLoaderRegistry.java:36)
at org.gradle.initialization.DefaultClassLoaderRegistry.<init>(DefaultClassLoaderRegistry.java:30)
at org.gradle.internal.service.scopes.GlobalScopeServices.createClassLoaderRegistry(GlobalScopeServices.java:215)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:547)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.internal.service.DefaultServiceRegistry.invoke(DefaultServiceRegistry.java:462)
at org.gradle.internal.service.DefaultServiceRegistry.access$1200(DefaultServiceRegistry.java:84)
at org.gradle.internal.service.DefaultServiceRegistry$FactoryMethodService.invokeMethod(DefaultServiceRegistry.java:796)
at org.gradle.internal.service.DefaultServiceRegistry$FactoryService.create(DefaultServiceRegistry.java:752)
at org.gradle.internal.service.DefaultServiceRegistry$ManagedObjectProvider.getInstance(DefaultServiceRegistry.java:589)
at org.gradle.internal.service.DefaultServiceRegistry$SingletonService.get(DefaultServiceRegistry.java:634)
at org.gradle.internal.service.DefaultServiceRegistry.applyConfigureMethod(DefaultServiceRegistry.java:253)
at org.gradle.internal.service.DefaultServiceRegistry.findProviderMethods(DefaultServiceRegistry.java:214)
at org.gradle.internal.service.DefaultServiceRegistry.addProvider(DefaultServiceRegistry.java:352)
at org.gradle.internal.service.ServiceRegistryBuilder.build(ServiceRegistryBuilder.java:52)
at org.gradle.launcher.cli.BuildActionsFactory.createGlobalClientServices(BuildActionsFactory.java:153)
at org.gradle.launcher.cli.BuildActionsFactory.runBuildWithDaemon(BuildActionsFactory.java:108)
at org.gradle.launcher.cli.BuildActionsFactory.createAction(BuildActionsFactory.java:83)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.createAction(CommandLineActionFactory.java:249)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:239)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:217)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:33)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:210)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:174)
at org.gradle.launcher.Main.doAction(Main.java:33)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:547)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:60)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:37)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected java.lang.Package[] java.lang.ClassLoader.getPackages() accessible: module java.base does not "opens java.lang" to unnamed module @2657d4dd
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:335)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:278)
at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:196)
at java.base/java.lang.reflect.Method.setAccessible(Method.java:190)
at org.gradle.internal.reflect.JavaMethod.<init>(JavaMethod.java:42)
at org.gradle.internal.reflect.JavaMethod.<init>(JavaMethod.java:32)
at org.gradle.internal.reflect.JavaMethod.<init>(JavaMethod.java:36)
at org.gradle.internal.reflect.JavaReflectionUtil.method(JavaReflectionUtil.java:223)
at org.gradle.internal.classloader.FilteringClassLoader.<clinit>(FilteringClassLoader.java:48)
... 40 more
Switching to Java 8 (via sudo update-alternatives --config java[c]) solved this for me.
I've ran into the same issue.
After reading https:/ /bugs.launchpad .net/ubuntu/ +source/ gradle/ +bug/1238322/ comments/ 8, I installed the package from Debian: https:/ /packages. debian. org/sid/ libnative- platform- jni.
This works only partially. It fails with a different error message:
FAILURE: Build failed with an exception.
* What went wrong: ExceptionInInit ializerError (no error message)
java.lang.
* Try:
Run with --info or --debug option to get more log output.
* Exception is: ExceptionInInit ializerError initialization. DefaultClassLoa derRegistry. restrictTo( DefaultClassLoa derRegistry. java:40) initialization. DefaultClassLoa derRegistry. restrictToGradl eApi(DefaultCla ssLoaderRegistr y.java: 36) initialization. DefaultClassLoa derRegistry. <init>( DefaultClassLoa derRegistry. java:30) internal. service. scopes. GlobalScopeServ ices.createClas sLoaderRegistry (GlobalScopeSer vices.java: 215) jdk.internal. reflect. NativeMethodAcc essorImpl. invoke0( Native Method) jdk.internal. reflect. NativeMethodAcc essorImpl. invoke( NativeMethodAcc essorImpl. java:62) jdk.internal. reflect. DelegatingMetho dAccessorImpl. invoke( DelegatingMetho dAccessorImpl. java:43) java.lang. reflect. Method. invoke( Method. java:547) internal. reflect. JavaMethod. invoke( JavaMethod. java:73) internal. service. DefaultServiceR egistry. invoke( DefaultServiceR egistry. java:462) internal. service. DefaultServiceR egistry. access$ 1200(DefaultSer viceRegistry. java:84) internal. service. DefaultServiceR egistry$ FactoryMethodSe rvice.invokeMet hod(DefaultServ iceRegistry. java:796) internal. service. DefaultServiceR egistry$ FactoryService. create( DefaultServiceR egistry. java:752) internal. service. DefaultServiceR egistry$ ManagedObjectPr ovider. getInstance( DefaultServiceR egistry. java:589) internal. service. DefaultServiceR egistry$ SingletonServic e.get(DefaultSe rviceRegistry. java:634) internal. service. DefaultServiceR egistry. applyConfigureM ethod(DefaultSe rviceRegistry. java:253) internal. service. DefaultServiceR egistry. findProviderMet hods(DefaultSer viceRegistry. java:214) internal. service. DefaultServiceR egistry. addProvider( DefaultServiceR egistry. java:352) internal. service. ServiceRegistry Builder. build(ServiceRe gistryBuilder. java:52) launcher. cli.BuildAction sFactory. createGlobalCli entServices( BuildActionsFac tory.java: 153) launcher. cli.BuildAction sFactory. runBuildWithDae mon(BuildAction sFactory. java:108) launcher. cli.BuildAction sFactory. createAction( BuildActionsFac tory.java: 83) launcher. cli.CommandLine ActionFactory$ ParseAndBuildAc tion.createActi on(CommandLineA ctionFactory. java:249) launcher. cli.CommandLine ActionFactory$ ParseAndBuildAc tion.execute( CommandLineActi onFactory. java:239) launcher. cli.CommandLine ActionFactory$ ParseAndBuildAc tion.execute( CommandLineActi onFactory. java:217) launcher. cli.JavaRuntime ValidationActio n.execute( JavaRuntimeVali dationAction. java:33) launcher. cli.JavaRuntime ValidationActio n.execute( JavaRuntimeVali dationAction. java:24) launcher. cli.ExceptionRe portingAction. execute( ExceptionReport ingAction. java:33) launcher. cli.ExceptionRe portingAction. execute( ExceptionReport ingAction. java:22) launcher. cli.CommandLine ActionFactory$ WithLogging. execute( CommandLineActi onFactory. java:210) launcher. cli.CommandLine ActionFactory$ WithLogging. execute( CommandLineActi onFactory. java:174) launcher. Main.doAction( Main.java: 33) launcher. bootstrap. EntryPoint. run(EntryPoint. java:45) jdk.internal. reflect. NativeMethodAcc essorImpl. invoke0( Native Method) jdk.internal. reflect. NativeMethodAcc essorImpl. invoke( NativeMethodAcc essorImpl. java:62) jdk.internal. reflect. DelegatingMetho dAccessorImpl. invoke( DelegatingMetho dAccessorImpl. java:43) java.lang. reflect. Method. invoke( Method. java:547) launcher. bootstrap. ProcessBootstra p.runNoExit( ProcessBootstra p.java: 60) launcher. bootstrap. ProcessBootstra p.run(ProcessBo otstrap. java:37) launcher. GradleMain. main(GradleMain .java:23) reflect. InaccessibleObj ectException: Unable to make protected java.lang.Package[] java.lang. ClassLoader. getPackages( ) accessible: module java.base does not "opens java.lang" to unnamed module @2657d4dd java.lang. reflect. AccessibleObjec t.checkCanSetAc cessible( AccessibleObjec t.java: 335) java.lang. reflect. AccessibleObjec t.checkCanSetAc cessible( AccessibleObjec t.java: 278) java.lang. reflect. Method. checkCanSetAcce ssible( Method. java:196) java.lang. reflect. Method. setAccessible( Method. java:190) internal. reflect. JavaMethod. <init>( JavaMethod. java:42) internal. reflect. JavaMethod. <init>( JavaMethod. java:32) internal. reflect. JavaMethod. <init>( JavaMethod. java:36) internal. reflect. JavaReflectionU til.method( JavaReflectionU til.java: 223) internal. classloader. FilteringClassL oader.< clinit> (FilteringClass Loader. java:48)
java.lang.
at org.gradle.
at org.gradle.
at org.gradle.
at org.gradle.
at java.base/
at java.base/
at java.base/
at java.base/
at org.gradle.
at org.gradle.
at org.gradle.
at org.gradle.
at org.gradle.
at org.gradle.
at org.gradle.
at org.gradle.
at org.gradle.
at org.gradle.
at org.gradle.
at org.gradle.
at org.gradle.
at org.gradle.
at org.gradle.
at org.gradle.
at org.gradle.
at org.gradle.
at org.gradle.
at org.gradle.
at org.gradle.
at org.gradle.
at org.gradle.
at org.gradle.
at org.gradle.
at java.base/
at java.base/
at java.base/
at java.base/
at org.gradle.
at org.gradle.
at org.gradle.
Caused by: java.lang.
at java.base/
at java.base/
at java.base/
at java.base/
at org.gradle.
at org.gradle.
at org.gradle.
at org.gradle.
at org.gradle.
... 40 more
Switching to Java 8 (via sudo update-alternatives --config java[c]) solved this for me.