gpt4 book ai didi

java - 由于 Gradle 失败 : Could not find javax. xml.datatype.DatatypeFactory,无法编译任何 Android 项目

转载 作者:行者123 更新时间:2023-11-29 21:00:06 26 4
gpt4 key购买 nike

这真的让我很烦,我已经安装并重新安装了 JDK、ADK、Android Studio 和 Gradle 好几次,而且顺序各不相同,但我无法让这个错误消失。要么我卸载时删除的内容不够多,要么与 OS X Yosemite 不兼容。也有可能我没有将 Android Studio 指向正确的 JDK 或 ADK……基本上,不知道发生了什么。任何帮助将不胜感激。

这是 gradle 堆栈跟踪:

org.gradle.internal.service.ServiceCreationException: Could not create service of type DefaultClassLoaderRegistry using GlobalScopeServices.createClassLoaderRegistry().
at org.gradle.internal.service.DefaultServiceRegistry$FactoryMethodService.invokeMethod(DefaultServiceRegistry.java:643)
at org.gradle.internal.service.DefaultServiceRegistry$FactoryService.create(DefaultServiceRegistry.java:597)
at org.gradle.internal.service.DefaultServiceRegistry$ManagedObjectProvider.getInstance(DefaultServiceRegistry.java:439)
at org.gradle.internal.service.DefaultServiceRegistry$SingletonService.get(DefaultServiceRegistry.java:479)
at org.gradle.internal.service.DefaultServiceRegistry.findConfigureMethod(DefaultServiceRegistry.java:145)
at org.gradle.internal.service.DefaultServiceRegistry.findProviderMethods(DefaultServiceRegistry.java:119)
at org.gradle.internal.service.DefaultServiceRegistry.addProvider(DefaultServiceRegistry.java:227)
at org.gradle.internal.service.ServiceRegistryBuilder.build(ServiceRegistryBuilder.java:52)
at org.gradle.launcher.cli.BuildActionsFactory.runBuildInProcess(BuildActionsFactory.java:167)
at org.gradle.launcher.cli.BuildActionsFactory.createAction(BuildActionsFactory.java:137)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.createAction(CommandLineActionFactory.java:242)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:232)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:33)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
Caused by: org.gradle.internal.service.UnknownServiceException: Could not find meta-data resource 'META-INF/services/javax.xml.datatype.DatatypeFactory' for service 'javax.xml.datatype.DatatypeFactory'.
at org.gradle.internal.service.ServiceLocator.getFactory(ServiceLocator.java:56)
at org.gradle.internal.classloader.DefaultClassLoaderFactory.makeServiceVisible(DefaultClassLoaderFactory.java:104)
at org.gradle.internal.classloader.DefaultClassLoaderFactory.createFilteringClassLoader(DefaultClassLoaderFactory.java:76)
at org.gradle.initialization.DefaultClassLoaderRegistry.restrictToGradleApi(DefaultClassLoaderRegistry.java:50)
at org.gradle.initialization.DefaultClassLoaderRegistry.<init>(DefaultClassLoaderRegistry.java:40)
at org.gradle.internal.service.scopes.GlobalScopeServices.createClassLoaderRegistry(GlobalScopeServices.java:115)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
at org.gradle.internal.service.DefaultServiceRegistry.invoke(DefaultServiceRegistry.java:328)
at org.gradle.internal.service.DefaultServiceRegistry.access$1200(DefaultServiceRegistry.java:58)
at org.gradle.internal.service.DefaultServiceRegistry$FactoryMethodService.invokeMethod(DefaultServiceRegistry.java:641)
... 27 more

最佳答案

我遇到了同样的问题,看了gradle的full stack trace,发现少了一个jar。其他丢失的 jar(如果有)将列在完整 堆栈跟踪中。

有问题的 jar 是 gradle 需要的 commons-lang3.jar。我在下面的步骤中安装了 jar

sudo apt-get install libcommons-lang3-java

然后我再次运行 gradle,它工作正常。

关于java - 由于 Gradle 失败 : Could not find javax. xml.datatype.DatatypeFactory,无法编译任何 Android 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26371301/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com