Cannot build project due to gradle project sync in

2019-05-12 00:42发布

问题:

I'm new on using android project version 0.82. I was creating a new apps (from scratch), and then I try to run the app. but the build process take forever because the gradle project sync failed, and in the top of the text editor, it says gradle project sync in progress. this takes forever. I've check the graddle wrapper properties, I've finished download the gradle 1.12 in the project before.

here is the idea log

2014-08-06 22:51:33,707 [ 284991]   INFO - llij.help.impl.HelpManagerImpl - Failed to load help set from 'jar:file:///C:\Users\stephen\AppData\Local\Android\android-studio\help\ideahelp.jar!/idea/Help.hs' 
javax.help.HelpSetException: Could not parse
Got an IOException (C:\Users\stephen\AppData\Local\Android\android-studio\help\ideahelp.jar (The system cannot find the path specified))
Parsing failed for null
  at javax.help.HelpSet.<init>(HelpSet.java:146)
  at com.intellij.help.impl.HelpManagerImpl.loadHelpSet(HelpManagerImpl.java:159)
  at com.intellij.help.impl.HelpManagerImpl.createHelpSet(HelpManagerImpl.java:133)
  at com.intellij.help.impl.HelpManagerImpl.invokeHelp(HelpManagerImpl.java:54)
  at com.intellij.ide.actions.ContextHelpAction.actionPerformed(ContextHelpAction.java:42)
  at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:164)
  at com.intellij.openapi.actionSystem.impl.ActionButton.actionPerformed(ActionButton.java:170)
  at com.intellij.openapi.actionSystem.impl.ActionButton.performAction(ActionButton.java:133)
  at com.intellij.openapi.actionSystem.impl.ActionButton.processMouseEvent(ActionButton.java:313)
  at java.awt.Component.processEvent(Component.java:6270)
  at java.awt.Container.processEvent(Container.java:2229)
  at java.awt.Component.dispatchEventImpl(Component.java:4861)
  at java.awt.Container.dispatchEventImpl(Container.java:2287)
  at java.awt.Component.dispatchEvent(Component.java:4687)
  at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
  at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
  at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
  at java.awt.Container.dispatchEventImpl(Container.java:2273)
  at java.awt.Window.dispatchEventImpl(Window.java:2719)
  at java.awt.Component.dispatchEvent(Component.java:4687)
  at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
  at java.awt.EventQueue.access$200(EventQueue.java:103)
  at java.awt.EventQueue$3.run(EventQueue.java:694)
  at java.awt.EventQueue$3.run(EventQueue.java:692)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
  at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
  at java.awt.EventQueue$4.run(EventQueue.java:708)
  at java.awt.EventQueue$4.run(EventQueue.java:706)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
  at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
  at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:697)
  at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:520)
  at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:335)
  at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
  at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
  at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
  at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

回答1:

Finally somehow after trying to invalidate the cache and restart several times doesn't give any effect, I try to restart my laptop and then it just worked. the build can finally be done.



回答2:

In interest of why it happens, the reason is staring you right in the face, at what it tells you in the beginning of the above error-log: "Failed to load help set" or some such. I'm completely baffled at how a project sync or build could affect this....

The IDE is attempting to launch or read from a HelpSet jar, perhaps because you pushed a help button or clicked a menu item. If the referenced JAR file actually exists at the specified location, then perhaps the internal file is not readable within the JAR.

That a restart "solves" this is again odd; best guess to correct this? In my case, NetBeans IDE has a console log that is accessible from the View menu, and I presume other IDEs have a debug, diagnostic, or "console" log somewhere. Check your IDE log(s); it may take a little bit of time and exploration to see what's being posted as output.

This isn't a strictly android-studio, or idea, or even Java problem, either; any sufficiently-developed bit of software or IDE can also experience this.