Gradle error : Write access is allowed from event

2019-01-21 05:45发布

问题:

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.

回答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



回答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



回答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)