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.
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