我的gradle突然停止工作了。当前配置是:
只需在命令提示符下运行命令 gradle ,我会收到以下消息:
* What went wrong:
Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
运行debug会显示以下附加消息:
23:11:45.439 [INFO] [org.gradle.internal.nativeintegration.services.NativeServices] Initialized native services in: C:\Users\<user>\.gradle\native
23:11:45.486 [DEBUG] [org.gradle.internal.nativeintegration.services.NativeServices] Native-platform posix files is not available. Continuing with fallback.
23:11:45.486 [DEBUG] [org.gradle.internal.nativeintegration.filesystem.services.FileSystemServices] Using JDK 7 file service org.gradle.internal.nativeintegration.filesystem.jdk7.WindowsJdk7Symlink
23:11:45.924 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClient] Executing build 3b214279-3ced-4a5f-ab1e-457e044f7c3f.1 in daemon client {pid=924}
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding IP addresses for network interface Software Loopback Interface 1
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a loopback interface? true
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a multicast interface? true
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding loopback address /127.0.0.1
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding loopback address /0:0:0:0:0:0:0:1
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding loopback multicast interface Software Loopback Interface 1
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding IP addresses for network interface vmxnet3 Ethernet Adapter
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a loopback interface? false
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a multicast interface? true
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding remote address /10.172.37.80
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding remote multicast interface vmxnet3 Ethernet Adapter
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding IP addresses for network interface Microsoft Kernel Debug Network Adapter
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a loopback interface? false
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a multicast interface? true
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding loopback multicast interface Microsoft Kernel Debug Network Adapter
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding IP addresses for network interface vmxnet3 Ethernet Adapter-WFP Native MAC Layer LightWeight Filter-0000
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a loopback interface? false
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a multicast interface? true
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding loopback multicast interface vmxnet3 Ethernet Adapter-WFP Native MAC Layer LightWeight Filter-0000
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding IP addresses for network interface vmxnet3 Ethernet Adapter-Symantec Endpoint Protection Firewall-0000
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a loopback interface? false
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a multicast interface? true
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding loopback multicast interface vmxnet3 Ethernet Adapter-Symantec Endpoint Protection Firewall-0000
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding IP addresses for network interface vmxnet3 Ethernet Adapter-QoS Packet Scheduler-0000
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a loopback interface? false
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a multicast interface? true
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding loopback multicast interface vmxnet3 Ethernet Adapter-QoS Packet Scheduler-0000
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding IP addresses for network interface vmxnet3 Ethernet Adapter-WFP 802.3 MAC Layer LightWeight Filter-0000
23:11:45.939 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a loopback interface? false
23:11:45.955 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a multicast interface? true
23:11:45.955 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding loopback multicast interface vmxnet3 Ethernet Adapter-WFP 802.3 MAC Layer LightWeight Filter-0000
23:11:45.955 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
23:11:45.955 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired.
23:11:46.002 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
23:11:46.017 [DEBUG] [org.gradle.internal.remote.internal.inet.TcpOutgoingConnector] Attempting to connect to [b4241497-ed70-4c43-8b4f-854517103401 port:53311, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]].
23:11:46.017 [DEBUG] [org.gradle.internal.remote.internal.inet.TcpOutgoingConnector] Trying to connect to address /127.0.0.1.
23:11:46.017 [DEBUG] [org.gradle.internal.remote.internal.inet.TcpOutgoingConnector] Connected to address /127.0.0.1:53311.
23:11:46.080 [INFO] [org.gradle.launcher.daemon.client.DaemonClient] Connected to daemon DaemonInfo{pid=7592, address=[b4241497-ed70-4c43-8b4f-854517103401 port:53311, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]], state=Idle, lastBusy=1536894331315, context=DefaultDaemonContext[uid=7ee1af1d-8759-44bf-84d3-69e6dd38a351,javaHome=C:\Program Files\Java\jdk1.8.0_144,daemonRegistryDir=C:\Users\<user>\.gradle\daemon,pid=7592,idleTimeout=10800000,daemonOpts=-Xms1g,-Xmx4g,-Dfile.encoding=windows-1252,-Duser.country=US,-Duser.language=en,-Duser.variant]}. Dispatching request Build{id=3b214279-3ced-4a5f-ab1e-457e044f7c3f.1, currentDir=D:\<myProject>}.
23:11:46.080 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: dispatching class org.gradle.launcher.daemon.protocol.Build
23:11:46.111 [INFO] [org.gradle.launcher.daemon.client.DaemonClient] Received result org.gradle.launcher.daemon.protocol.BuildStarted@198d6542 from daemon DaemonInfo{pid=7592, address=[b4241497-ed70-4c43-8b4f-854517103401 port:53311, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]], state=Idle, lastBusy=1536894331315, context=DefaultDaemonContext[uid=7ee1af1d-8759-44bf-84d3-69e6dd38a351,javaHome=C:\Program Files\Java\jdk1.8.0_144,daemonRegistryDir=C:\Users\<user>\.gradle\daemon,pid=7592,idleTimeout=10800000,daemonOpts=-Xms1g,-Xmx4g,-Dfile.encoding=windows-1252,-Duser.country=US,-Duser.language=en,-Duser.variant]} (build should be starting).
23:11:46.111 [INFO] [org.gradle.launcher.daemon.server.exec.LogToClient] The client will now receive all logging from the daemon (pid: 7592). The daemon log file: C:\Users\<user>\.gradle\daemon\3.2.1\daemon-7592.out.log
23:11:46.111 [INFO] [org.gradle.launcher.daemon.server.exec.LogAndCheckHealth] Starting 5th build in daemon [uptime: 11 mins 37.485 secs, performance: 100%, no major garbage collections]
23:11:46.111 [DEBUG] [org.gradle.launcher.daemon.server.exec.ExecuteBuild] The daemon has started executing the build.
23:11:46.111 [INFO] [org.gradle.launcher.daemon.server.exec.ExecuteBuild] Executing build with daemon context: DefaultDaemonContext[uid=7ee1af1d-8759-44bf-84d3-69e6dd38a351,javaHome=C:\Program Files\Java\jdk1.8.0_144,daemonRegistryDir=C:\Users\<user>\.gradle\daemon,pid=7592,idleTimeout=10800000,daemonOpts=-Xms1g,-Xmx4g,-Dfile.encoding=windows-1252,-Duser.country=US,-Duser.language=en,-Duser.variant]
23:11:46.111 [DEBUG] [org.gradle.launcher.daemon.server.exec.ExecuteBuild] The daemon has finished executing the build.
23:11:46.174 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientInputForwarder] Dispatching close input message: org.gradle.launcher.daemon.protocol.CloseInput@f173c7e
23:11:46.189 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 14: dispatching class org.gradle.launcher.daemon.protocol.CloseInput
23:11:46.189 [INFO] [org.gradle.launcher.daemon.client.DaemonClient] Received result Failure[value=org.gradle.internal.service.ServiceCreationException: Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().] from daemon DaemonInfo{pid=7592, address=[b4241497-ed70-4c43-8b4f-854517103401 port:53311, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]], state=Idle, lastBusy=1536894331315, context=DefaultDaemonContext[uid=7ee1af1d-8759-44bf-84d3-69e6dd38a351,javaHome=C:\Program Files\Java\jdk1.8.0_144,daemonRegistryDir=C:\Users\<user>\.gradle\daemon,pid=7592,idleTimeout=10800000,daemonOpts=-Xms1g,-Xmx4g,-Dfile.encoding=windows-1252,-Duser.country=US,-Duser.language=en,-Duser.variant]} (build should be done).
23:11:46.189 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: dispatching class org.gradle.launcher.daemon.protocol.Finished
23:11:46.205 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: connection stop
23:11:46.205 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
23:11:46.205 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
23:11:46.205 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
23:11:46.205 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
23:11:46.205 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
23:11:46.205 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
23:11:46.205 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try:
23:11:46.205 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Run with --stacktrace option to get the stack trace.
还运行了完整的跟踪记录,并收到以下消息:
Caused by: org.gradle.api.GradleException: Could not generate a proxy class for class org.gradle.plugin.repository.internal.DefaultPluginRepositoryFactory.
at org.gradle.api.internal.AbstractClassGenerator.generateUnderLock(AbstractClassGenerator.java:201)
at org.gradle.api.internal.AbstractClassGenerator.generate(AbstractClassGenerator.java:64)
at org.gradle.api.internal.ClassGeneratorBackedInstantiator.newInstance(ClassGeneratorBackedInstantiator.java:36)
at org.gradle.plugin.use.internal.PluginUsePluginServiceRegistry$BuildScopeServices.createPluginRepositoryFactory(PluginUsePluginServiceRegistry.java:125)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
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)
... 65 more
Caused by: java.lang.IncompatibleClassChangeError: Found interface org.objectweb.asm.MethodVisitor, but class was expected
at org.gradle.api.internal.AsmBackedClassGenerator$ClassBuilderImpl.addGetter(AsmBackedClassGenerator.java:426)
at org.gradle.api.internal.AsmBackedClassGenerator$ClassBuilderImpl.addGetter(AsmBackedClassGenerator.java:421)
at org.gradle.api.internal.AsmBackedClassGenerator$ClassBuilderImpl.mixInDynamicAware(AsmBackedClassGenerator.java:206)
at org.gradle.api.internal.AbstractClassGenerator.generateUnderLock(AbstractClassGenerator.java:105)
试图搜索这两个例外,但到目前为止仍无济于事。有任何建议或想法吗?
答案 0 :(得分:2)
将gradle版本从4.7设置为4.8为我解决了此问题。在gradle-wrapper.properties中,使用以下行代替旧行:
distributionUrl = https://services.gradle.org/distributions/gradle-4.8-all.zip
答案 1 :(得分:1)
我可能通过安装Java JDK 11破坏了 gradle 4.7 。解决方案是升级 gradle 。
当我使用MacOS并使用 homebrew 安装 gradle 时,我已经像这样升级了它:
brew upgrade gradle
现在我有 gradle 5.0 ,并且运行良好。
答案 2 :(得分:0)
gradle-wrapper.properties文件中的4.7版对我有用。
此后,我确实必须继续执行File-> Invalidate Caches / Restart,然后执行Build / Clean Project。
答案 3 :(得分:0)
在我的情况下,distributionUrl
中的/gradle/wrapper/gradle-wrapper.properties
有一个错字。我正在使用,如下所示。
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-5.5-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
答案 4 :(得分:0)
您可以尝试以下解决方案: 如果您想通过简单的方法做到这一点:
Windows Defender>病毒和威胁防护>勒索软件防护>禁用保护。
Windows Defender>病毒和威胁防护>病毒和威胁防护设置(管理设置)>实时防护>无法进行实时防护。
如果您想以最佳方式做到这一点(考虑到您的安全性):
Windows Defender>病毒和威胁防护>勒索软件防护>通过受监视的文件夹访问的APP>添加允许的APP>最后被阻止的应用程序>添加Studio64 / Studio.exe(您需要启用隐藏文件夹才能打开ProgramData)。 / p>
然后,转到Windows资源管理器C:\ProgramData\Microsoft\Windows Defender\Scans\History
删除该文件夹中的所有内容。
检查项目的文件夹是否在排除文件夹中。 Windows Defender>病毒和威胁防护>病毒和威胁防护设置>添加或删除排除项。
Android Studio现在应该可以正常工作了:D。