Java Android Studio 设计编辑器在项目同步成功后才可用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/53195701/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 00:45:08  来源:igfitidea点击:

Android studio design editor is unavailable until after a successful project sync

javaandroid-studio

提问by Eman Fateen

what is the actual root cause of this issue? I already sync with gradle files but eventually failed.

这个问题的真正根本原因是什么?我已经与 gradle 文件同步,但最终失败了。

image screen

图像屏幕

采纳答案by Ridha Rezzag

Just sync your project with gradles. File --> Sync Project with Gradle Files

只需将您的项目与 gradle 同步。文件 --> 将项目与 Gradle 文件同步

回答by Prasad Jayathilake

Issue happened to me when I changed the res>values>styles.xml

当我更改时,问题发生在我身上 res>values>styles.xml

What I change was
"Theme.AppCompat.Light.DarkActionBar"--->>> "Base.Theme.AppCompat.Light.DarkActionBar"

我改变的是
"Theme.AppCompat.Light.DarkActionBar"--->>>"Base.Theme.AppCompat.Light.DarkActionBar"

Solutions I tried.

我试过的解决方案。

  1. Build -> Rebuild Project (Not worked)
  2. Close all files and Open again. Then Build -> Clean Project (Not worked) File -> Sync project with gradle files (Not worked)
  3. Close the Android Studio while project still opened. Opened it again. - It Worked.
  1. 构建 -> 重建项目(无效)
  2. 关闭所有文件并再次打开。然后 Build -> Clean Project (Not work) File -> Sync project with gradle files (Not work)
  3. 在项目仍处于打开状态时关闭 Android Studio。又打开了。- 有效。

回答by Abdullah Almasud

  1. Build -> Clean Project
  2. Build -> Rebuild Project
  3. File -> Sync project with gradle files . If not worked then try

    File -> Invalidate Caches / Restart .

  1. 构建 -> 清理项目
  2. 构建 -> 重建项目
  3. 文件 -> 将项目与 gradle 文件同步。如果不起作用,请尝试

    File -> Invalidate Caches / Restart 。

It's work for me !!!

这对我有用!!!

回答by cesards

That could be fixed in one or two steps, depending on how nice is Android Studio today:

这可以通过一两个步骤来解决,具体取决于今天的 Android Studio 有多好:

  1. Try to sync your project with gradle files:
  1. 尝试将您的项目与 gradle 文件同步:

enter image description here

enter image description here

  1. If that doesn't work, invalidate Android Studio caches and restart. That should fix the problem:
  1. 如果这不起作用,请使 Android Studio 缓存无效并重新启动。这应该可以解决问题:

enter image description here

enter image description here

The reason behind the first solution not working could be related on gradle cached dependencies problems, but who knows

第一个解决方案不起作用的原因可能与 gradle 缓存依赖项问题有关,但谁知道

回答by Moment Mnt

Just you have to do >> open File --> Sync Project with Gradle Files and then after >> open File --> invalidate Android Studio caches / restart so done this problem.:)

只是你必须做 >> 打开文件 --> 将项目与 Gradle 文件同步,然后在 >> 打开文件 --> 使 Android Studio 缓存无效/重新启动,这样就解决了这个问题。:)

回答by ABHISHEK RAJ

If nothing of the above steps work, Then simply undo the changes that you have recently made, and then build gradle. In my case, I have added one dependencies and this problem raised, so I removed that dependencies build the gradle and then again add it. Problem Solved..!!

如果以上步骤都不起作用,那么只需撤消您最近所做的更改,然后构建 gradle。就我而言,我添加了一个依赖项并引发了此问题,因此我删除了该依赖项构建了 gradle,然后再次添加它。问题解决了..!!