在将 Android Studio 更新到 2.2 版(在 Windows 10 上)之后,不知何故,第二天早上,当 gradle 构建在任何项目上时,我收到了这样的错误:
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
尽管 gradlew -build 命令工作并成功完成.我尝试了典型的 Android 开发者的 WTF 修复集:清理构建、无效缓存、删除构建文件夹、删除 .gradle 文件夹、尝试不同的 gradle 设置,甚至重新安装 Android Studio,但没有任何帮助.
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.
所以问题归结为Android Studio和我安装的JDK版本冲突,所以我查看JDK位置(文件→项目结构→SDK位置)解决了),勾选使用嵌入式 JDK"复选框并将 JDK 位置设置为Android Studio 路径"Android Studiojre
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 Studiojre
这篇关于Gradle 错误:仅在 Android Studio 中允许从事件调度线程进行写访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!