android – Gradle项目同步失败,没有消息,在命令行上工作
作者:互联网
在Android Studio中,同步失败:
Gradle project sync failed. Basic functionality (e.g. editing, debugging) will not work properly.
命令行gradle installDebug工作. “消息”视图中没有消息.在idea.log中,出现以下NullPointerException:
2018-02-04 14:53:15,233 [ thread 15] WARN - ea.IdeaSyncPopulateProjectTask - Sync failed: null
java.lang.RuntimeException: java.lang.NullPointerException
at com.intellij.openapi.application.impl.LaterInvocator.invokeAndWait(LaterInvocator.java:188)
at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:680)
at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:685)
at com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil.executeOnEdt(ExternalSystemApiUtil.java:469)
at com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil.executeProjectChangeAction(ExternalSystemApiUtil.java:458)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManager.dispose(ProjectDataManager.java:401)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManager.importData(ProjectDataManager.java:156)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManager.importData(ProjectDataManager.java:198)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManager.importData(ProjectDataManager.java:204)
at com.android.tools.idea.gradle.project.sync.idea.IdeaSyncPopulateProjectTask.doSelectiveImport(IdeaSyncPopulateProjectTask.java:206)
at com.android.tools.idea.gradle.project.sync.idea.IdeaSyncPopulateProjectTask.populate(IdeaSyncPopulateProjectTask.java:156)
at com.android.tools.idea.gradle.project.sync.idea.IdeaSyncPopulateProjectTask.access$000(IdeaSyncPopulateProjectTask.java:51)
at com.android.tools.idea.gradle.project.sync.idea.IdeaSyncPopulateProjectTask$1.run(IdeaSyncPopulateProjectTask.java:144)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:726)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:176)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:556)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:501)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:66)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:163)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$1.run(ProgressManagerImpl.java:137)
at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:334)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
at com.intellij.openapi.extensions.Extensions.disposeArea(Extensions.java:168)
at com.intellij.openapi.module.impl.ModuleImpl.dispose(ModuleImpl.java:153)
at com.intellij.openapi.util.Disposer$1.execute(Disposer.java:48)
at com.intellij.openapi.util.Disposer$1.execute(Disposer.java:44)
at com.intellij.openapi.util.objectTree.ObjectTree.executeActionWithRecursiveGuard(ObjectTree.java:151)
at com.intellij.openapi.util.objectTree.ObjectTree.executeUnregistered(ObjectTree.java:163)
at com.intellij.openapi.util.objectTree.ObjectTree.executeAll(ObjectTree.java:132)
at com.intellij.openapi.util.Disposer.dispose(Disposer.java:123)
at com.intellij.openapi.util.Disposer.dispose(Disposer.java:119)
at com.intellij.openapi.module.impl.ModuleManagerImpl$ModuleModelImpl.dispose(ModuleManagerImpl.java:836)
at com.intellij.openapi.externalSystem.service.project.AbstractIdeModifiableModelsProvider.dispose(AbstractIdeModifiableModelsProvider.java:421)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManager$3.execute(ProjectDataManager.java:404)
at com.intellij.openapi.externalSystem.util.DisposeAwareProjectChange.run(DisposeAwareProjectChange.java:36)
at com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil.lambda$null$6(ExternalSystemApiUtil.java:458)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1023)
at com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil.lambda$executeProjectChangeAction$7(ExternalSystemApiUtil.java:458)
at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:303)
at com.intellij.openapi.application.impl.LaterInvocator$1.run(LaterInvocator.java:165)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:410)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:399)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:762)
at java.awt.EventQueue.access$500(EventQueue.java:98)
at java.awt.EventQueue$3.run(EventQueue.java:715)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:732)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:827)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:655)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:365)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
2018-02-04 14:53:15,234 [ thread 15] INFO - e.project.sync.GradleSyncState - Gradle sync failed (4s 121ms)
Using Invalidate Caches/Restart
and removing the .gradle
folder没有帮助.为什么是这样?它是如何修复的?
解决方法:
在设置>中取消设置本地gradle分发后构建,执行,部署> Gradle(设置用于调试此问题),Android Studio提供更新为gradle:3.0.1 from gradle:3.0.0.这解决了它.
以前的步骤:
>将google()存储库添加到buildscript和allprojects
>将compileSdkVersion和targetSdkVersion升级到27
>将所有com.android.support库升级到26.1.0
标签:android,android-gradle,android-studio-3-1 来源: https://codeday.me/bug/20190828/1748615.html