java - Gradle 同步失败,导致“在成功构建项目同步后预览不可用”
问题描述
我正在尝试打开一个非常旧的 android 应用程序,因为我需要对其进行升级。我更新了 Gradle 插件、Gradle 以及 SDK 工具,该项目正在我的设备上编译和运行。
问题是我无法使用我的 XML 文件的预览窗口并且我不断收到此错误 -
Gradle 同步失败:EventQueue.isDispatchThread()=false >Toolkit.getEventQueue()=com.intellij.ide.IdeEventQueue@15b8713b 当前线程:Thread[ApplicationImpl pooled thread >19,4,Idea Thread Group] 1926886061 SystemEventQueueThread:Thread[AWT -EventQueue-0,6,Idea >Thread Group] 686233834 (905 ms)
我试图清理和重建项目,试图使缓存无效并重新启动甚至重新启动计算机,因为我认为一个线程丢失了......
有人遇到过这个问题吗?
更新:
问题解决了。
我在 Manifest 和 Gradle 中都声明了minSdkVersion和targetSdkVersion 。从清单中删除它解决了这个问题。
解决方案
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
This is a common problem. It can be easily solved by changing res/values/styles.xml to
<!-- Base application theme. -->
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
Steps :
Go to res/values/
open styles.xml
change from -> style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"
change to -> style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar"
(Just prepend "Base." to "Theme".)
Save the file and check Preview now.
Preview Works Perfectly now.
推荐阅读
- android - 如何预下载 HERE 地图图块以供离线使用
- php - 使用 .htaccess 为多语言站点重写 URL(多个变量)
- r - r - 在列表的任何元素中查找字符串,然后使用该列表元素的名称
- haskell - Haskell中的函数类型签名而不使用解释器
- c++ - 将复杂参数列表与类模板一起使用
- java - 在 Java 中设置不同的驻留堆大小和总换出的虚拟内存大小
- structured-data - Google结构化数据测试工具和微格式hcard的问题
- html - 找不到 Django 全局静态文件
- java - 您将如何重构 Arrays.copyOf() 方法以删除 @SuppressWarnings("unchecked") 注释?
- java - 警报对话框仅模糊部分屏幕