当前位置: 首页 > news >正文

Android Studio 布局无法预览的问题:Access from Event Dispatch Thread (EDT) is not allowed

<!-- 原来是这样 --><androidx.constraintlayout.widget.ConstraintLayoutxmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"xmlns:tools="http://schemas.android.com/tools"android:id="@+id/main"android:layout_width="match_parent"android:layout_height="match_parent"tools:context=".activity.MainActivity"><Buttonandroid:id="@+id/btn_go_test"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="前往测试"/></androidx.constraintlayout.widget.ConstraintLayout>
<!-- 修改成这样 --><androidx.constraintlayout.widget.ConstraintLayoutxmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"xmlns:tools="http://schemas.android.com/tools"android:id="@+id/main"android:layout_width="match_parent"android:layout_height="match_parent"tools:context=".activity.MainActivity"><Buttonandroid:id="@+id/btn_go_test"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="前往测试"app:layout_constraintBottom_toBottomOf="parent"/></androidx.constraintlayout.widget.ConstraintLayout>
  • 对上述布局代码进行修改之后,Android Studio 出现如下错误信息,同时无法预览布局
com.intellij.openapi.diagnostic.RuntimeExceptionWithAttachments: Access from Event Dispatch Thread (EDT) is not allowed; see https://jb.gg/ij-platform-threading for details Current thread: Thread[#57,AWT-EventQueue-0,10,main] 254734910 (EventQueue.isDispatchThread()=true) SystemEventQueueThread: (same)
问题原因
  • 这个错误是 Android Studio 的一个 Bug,与布局代码本身无关
处理策略
  • 清理项目(Clean Project),即可正常预览布局
http://www.jsqmd.com/news/1106465/

相关文章:

  • 2026法国名义雇主EOR服务权威推荐榜单
  • 2026年设计行业必备!一对一兴弘设计培训班究竟有何独特魅力?
  • Claude Code 被封后,我才意识到,Agent 工作流必须能一键迁移
  • 客户体验在AI时代下的重塑与跃迁动响应到主动创造:AI驱动的客户体验跃迁与Share Creators的设计资产智能协同新范式从被
  • 2026年AI论文工具核心能力速览
  • 【MO MTSP】麝牛算法MO求解单仓库多旅行商问题【含Matlab源码 15683期】
  • 如何用UABEA彻底改变你的Unity资源编辑体验:从入门到精通的完整指南
  • 【共创季稿事节】鸿蒙原生 ArkTS 布局方式之 PanGesture 拖拽手势布局:从原理到实战
  • ai网站开发公司有哪些?2026年6月ai建站公司推荐
  • 如何降低大模型调用带来的成本
  • 广东省工程技术研究中心认定对企业有什么好处?如何申报
  • 如何保证seedance2.0风格一致
  • VBA技术资料502_VBA_检索文件名及文件的扩展名
  • 服务启动失败、日志无报错?Linux系统级隐形故障完整排查指南
  • 工业级 4G 智能网关怎么选?2026 最新评测:IPCSUN PGM1120A 架构深度解析与选型指南
  • show-靶机
  • MSC许可使用中的常见问题及解决方案
  • AI 编程工具每月花多少钱?一个独立开发者的真实账单
  • 自动化交易精髓:硬核拆解 TMGM MT4 四大挂单(Pending Orders)的触发逻辑
  • 数字化转型下的许可优化:企业竞争新优势
  • ManageEngine卓豪-零信任架构
  • 贴片共模电感选型中的“不可能三角”
  • AI在互联网开发工作中的应用
  • 深度Q网络DQN工程落地:从原理到边缘设备部署
  • 2026年免费AI数据可视化大屏工具推荐:五款主流产品深度测评
  • Light: Sci Appl 封面级研究 | 上交大团队研制双层光子超材料,被动降温至145K刷新纪录
  • AI时代,数据库正在走向哪?
  • 小红书开头怎么写抓人?5个钩子公式让读者忍不住往下看
  • 紧急提醒!登报挂失去哪里办理?登报挂失有法律效应吗?
  • PandaGPT六模态融合:工业物理感知与鲁棒诊断实战