Gradle error: Write access is allowed from event dispatch thread only in Android Studio

60,992

Solution 1

So the problem was concluded in that Android Studio conflicted with my installed JDK version, so it was resolved when I checked JDK location (File → Project Structure → SDK Location), ticked 'Use embedded JDK' checkbox and set JDK location to 'path to Android Studio'\Android Studio\jre

Solution 2

Problem was occurred when android studio conflict with installed jdk version, Go to the (File -> Project Structure -> SDK Location), check 'Use embedded JDK' checkbox and set jdk location to 'path to android studio'\Android Studio\jre :) Simple

Solution 3

that didn't work for me, i ran a 'gradle clean build' command, i figured out that there's a conflict in a line in the gradle, deleted it and sync project (as in this pic)

enter image description here

Share:
60,992
Beloo
Author by

Beloo

Updated on July 03, 2020

Comments

  • Beloo
    Beloo almost 4 years

    After updating Android Studio to version 2.2 (on Windows 10) and somehow next morning I received such error when gradle built on any project:

    Write access is allowed from event dispatch thread only

    Despite that gradlew -build command worked and completed successfully. I tried typical Android dev's of WTF repairing set: clean build, invalidate caches, removing build folders, removing .gradle folder, tried different gradle settings, even reinstalling Android Studio and nothing helped.

    I've created this question only to share my experience with community, because I wasted two hours on it.

  • Ryuzaki
    Ryuzaki over 6 years
    this is what worked for me for this question, it may help others who had my same prob for the same question
  • waseefakhtar
    waseefakhtar over 5 years
    Worked well for me! Thanks a lot!
  • sam
    sam over 5 years
    Perfect answer! Worked instantly. Just when I click opened the project structure upon reading this answer, the Project Structure dialog itself showed a message at the bottom of the dialog stating "Please choose a valid JDK directory", accompanied by a navigation button, which upon clicking navigated to the JDK location text box as well. I currently use Android Studio 3.1.3 on my Ubuntu. Thanks!