mcfly soft
mcfly soft

Reputation: 11645

Upgraded AndroidStudio to 3.4.1 and gradle problems

I have upgraded an Android Project from 3.2 to 3.4.1 and now I have gradle Problems.

The only indication is the bar at the top

enter image description here

and a message in the Event Log.

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)

I have cleaned rebuilt project.

Clicking on Open Build View -> nothing happens.

Log File contains:

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)

Howto analyse this, How to get a meaningfull message. Its very frustrating to be blind every upgrade of Androidstudio. Is there a way to execute the sync by console / terminal ?

Update I could restrict the case. I found out this happens only if I am adding a android library (module). I can't understand why thi happens.

Update 2 I found the solution for me. The upgrade process added the following into my gradle script, which caused the problem. After removing it worked:

compileOptions.encoding = 'ISO-8859-1' productFlavors { }

The question is still open. How can we analyse this kind of issue in a professional way. I had to compare files without knowing without any contextual path.

Upvotes: 3

Views: 2849

Answers (3)

bundy79
bundy79

Reputation: 116

Though not in Android Studio 3.4.1, but I got a very similar error message in a newer version (4.1.3), so I ended up here. For me the problem was that Kotlin version that is used for Gradle differed from the IDE plugin version.

The message was:

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 

Make sure that ext.kotlin_version in your buildscript is the same as the plugin version (File/Settings/Plugins in Android Studio 4.1.3).

Upvotes: 1

Leonid Ivankin
Leonid Ivankin

Reputation: 667

It was good for me. Download some components:

enter image description here

Upvotes: 6

EngineerDanny
EngineerDanny

Reputation: 865

I used this trick to fix the problem I had with my gradle. First get a good internet connection and go to your local disk C: \Users \YourUsername. You will see a .gradle file there. Delete it and run android studio again for it to download everything again.

Upvotes: 1

Related Questions