我从昨天开始学习Android Studio.我试着回应简单的"Hello World":
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:id="@+id/activity_main"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp"
android:paddingBottom="16dp"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
但是当我点击"设计"视图时,会出现此错误?
在成功构建之前,设计编辑器不可用
我该如何解决这个错误.我昨天刚刚下载了Android Studio.
我刚注意到我的xml代码导致错误.这就是为什么这可能不起作用.非常感谢
小智 291
转到文件>使用Gradles文件同步项目.
小智 31
退出Android Studio(不是关闭该项目Quit的Android Studio),然后打开该项目,并去Android Studio > Build > Clean Project
然后
Android Studio > File > Sync Project with Gradles Files如下图
如果您的问题仍然存在,请单击下面的安装构建工具,然后单击下面的图片
Android Studio > File > Sync Project with Gradles Files
dph*_*ans 10
build.gradle在项目的所有模块中找到你的,包括app/build.gradle. 找到compileSdkVersion里面的android标签,在这种情况下,编译sdk版本是30:这个问题经常出现在项目有很多模块时,每个模块使用不同的编译 SDK 版本,因此应用程序可能能够构建但 IDE 在处理您的资源时会出现一些问题。
| 归档时间: |
|
| 查看次数: |
130057 次 |
| 最近记录: |