我已经将Android项目从3.2升级到3.4.1,现在遇到了问题。
唯一的指示是顶部的栏
和事件日志中的一条消息。
Gradle sync failed: EventQueue.isDispatchThread()=false Toolkit.getEventQueue()=com.intellij.ide.IdeEventQueue@34e0424
Current thread: Thread[ApplicationImpl pooled thread 19,4,Idea Thread Group] 388194366
SystemEventQueueThread: Thread[AWT-EventQueue-0,6,Idea Thread Group] 847161915 (1 s 526 ms)
我已经清理了重建的项目。
单击“打开构建视图”->没有任何反应。
日志文件包含:
INFO - e.project.sync.GradleSyncState - Finished source generation of project 'Chronica'.
2019-05-26 10:04:57,336 [thread 126] INFO - ule.android.SdkModuleSetupStep - Set Android SDK 'Android API 26 Platform' (C:\Users\andreas\AppData\Local\Android\Sdk) to module 'LVLLibrary'
2019-05-26 10:04:57,340 [thread 126] INFO - ule.android.SdkModuleSetupStep - Set Android SDK 'Android API 28 Platform' (C:\Users\andreas\AppData\Local\Android\Sdk) to module 'app'
2019-05-26 10:04:57,425 [thread 126] INFO - e.project.sync.GradleSyncState - Gradle sync failed: EventQueue.isDispatchThread()=false Toolkit.getEventQueue()=com.intellij.ide.IdeEventQueue@34e0424
Current thread: Thread[ApplicationImpl pooled thread 126,4,Idea Thread Group] 812028699
SystemEventQueueThread: Thread[AWT-EventQueue-0,6,Idea Thread Group] 847161915 (852 ms)
2019-05-26 10:04:57,425 [thread 126] WARN - ject.sync.ng.SyncResultHandler - Gradle sync failed
com.intellij.openapi.diagnostic.RuntimeExceptionWithAttachments: EventQueue.isDispatchThread()=false Toolkit.getEventQueue()=com.intellij.ide.IdeEventQueue@34e0424
Current thread: Thread[ApplicationImpl pooled thread 126,4,Idea Thread Group] 812028699
SystemEventQueueThread: Thread[AWT-EventQueue-0,6,Idea Thread Group] 847161915
at com.intellij.openapi.application.impl.ApplicationImpl.assertIsDispatchThread(ApplicationImpl.java:1133)
at com.intellij.openapi.application.impl.ApplicationImpl.assertIsDispatchThread(ApplicationImpl.java:1122)
at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.saveAllDocuments(FileDocumentManagerImpl.java:289)
at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.saveAllDocuments(FileDocumentManagerImpl.java:282)
at com.intellij.openapi.vfs.encoding.EncodingProjectManagerImpl.tryStartReloadWithProgress(EncodingProjectManagerImpl.java:361)
at com.intellij.openapi.vfs.encoding.EncodingProjectManagerImpl.reloadAllFilesUnder(EncodingProjectManagerImpl.java:366)
at com.intellij.openapi.vfs.encoding.EncodingProjectManagerImpl.setEncoding(EncodingProjectManagerImpl.java:180)
at com.intellij.openapi.vfs.encoding.EncodingProjectManagerImpl.setDefaultCharsetName(EncodingProjectManagerImpl.java:408)
at com.android.tools.idea.gradle.project.sync.validation.android.EncodingValidationStrategy.fixAndReportFoundIssues(EncodingValidationStrategy.java:83)
at com.android.tools.idea.gradle.project.sync.validation.android.AndroidModuleValidator$AndroidModuleValidatorImpl.fixAndReportFoundIssues(AndroidModuleValidator.java:63)
at com.android.tools.idea.gradle.project.sync.ng.AndroidModuleProcessor.processAndroidModels(AndroidModuleProcessor.java:63)
at com.android.tools.idea.gradle.project.sync.ng.SyncProjectModelsSetup.setUpModules(SyncProjectModelsSetup.java:143)
at com.android.tools.idea.gradle.project.sync.ng.ProjectSetup$ProjectSetupImpl.setUpProject(ProjectSetup.java:69)
at com.android.tools.idea.gradle.project.sync.ng.SyncResultHandler.setUpProject(SyncResultHandler.java:136)
at com.android.tools.idea.gradle.project.sync.ng.SyncResultHandler.onSyncFinished(SyncResultHandler.java:88)
at com.android.tools.idea.gradle.project.sync.ng.SyncResultHandler.lambda$onCompoundSyncModels$6(SyncResultHandler.java:268)
at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:314)
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)
如何对此进行分析,如何获得有意义的消息。每次Androidstudio升级都盲目地感到非常沮丧。 有没有办法通过控制台/终端执行同步?
更新 我可以限制这种情况。我发现只有在添加android库(模块)时才会发生这种情况。我不明白为什么会这样。
更新2 我找到了解决方案。升级过程将以下内容添加到我的gradle脚本中,从而导致了问题。删除后有效:
compileOptions.encoding ='ISO-8859-1' productFlavors { }
问题仍然存在。我们如何以专业的方式分析此类问题。我不得不在不知道上下文路径的情况下比较文件。
答案 0 :(得分:1)
虽然不是在 Android Studio 3.4.1 中,但我在较新的版本 (4.1.3) 中收到了非常相似的错误消息,所以我最终到了这里。 对我来说,问题是用于 Gradle 的 Kotlin 版本与 IDE 插件版本不同。
消息是:
Gradle sync failed: EventQueue.isDispatchThread()=false Toolkit.getEventQueue()=com.intellij.ide.IdeEventQueue@3e2d155f
Current thread: Thread[ApplicationImpl pooled thread 6,4,Idea Thread Group] 219783907
SystemEventQueueThread: Thread[AWT-EventQueue-0,6,Idea Thread Group] 255359391
确保构建脚本中的 ext.kotlin_version
与插件版本(Android Studio 4.1.3 中的文件/设置/插件)相同。
答案 1 :(得分:0)
我用这个技巧来解决我的gradle问题。首先获得良好的Internet连接,然后转到本地磁盘C:\ Users \ YourUsername。您将在此处看到一个.gradle文件。删除它并再次运行android studio以便再次下载所有内容。
答案 2 :(得分:0)