未使用 Android Studio 选择渲染目标
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22776653/
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
No rendering target selected using Android Studio
提问by weinek
My Android Studio in activity_main.xml showing this problem: "Rendering Problems No render target selected" Help?
我在 activity_main.xml 中的 Android Studio 显示此问题:“渲染问题未选择渲染目标”帮助?
回答by Chinedu
You need to run the AVD Manager to add a virtual device that matches the target API version your project is set to. Click Tools->Android->AVD Manager. Click on 'New', add virtual devices targeting higher API levels, e.g 18, 19, etc. Then restart Android Studio, and open your project, it should find a target device to allow you access to the Design view.
您需要运行 AVD 管理器来添加与您的项目设置的目标 API 版本匹配的虚拟设备。单击工具->Android->AVD 管理器。单击“新建”,添加针对更高 API 级别(例如 18、19 等)的虚拟设备。然后重新启动 Android Studio,并打开您的项目,它应该会找到一个目标设备以允许您访问设计视图。
回答by tuygun
Top menu bar on the left side of the AVD Manager button you have a "Sync Project with Gradle Files" button. Click that. Android Studio may become sluggish for like 5 seconds, but you'll also see a loading wheel in the project files tab, and possibly a yellow bar on the top of activity_main.xml tab saying that Gradle is syncing. In about 5 seconds everything will be up to date, and you will see the device as expected. Hope this helps.
AVD 管理器按钮左侧的顶部菜单栏有一个“将项目与 Gradle 文件同步”按钮。单击那个。Android Studio 可能会变得缓慢大约 5 秒钟,但您还会在项目文件选项卡中看到一个加载轮,并且可能在 activity_main.xml 选项卡顶部有一个黄色栏,表示 Gradle 正在同步。大约 5 秒后,一切都会更新,您将按预期看到设备。希望这可以帮助。
回答by Dr. Hasan Hashem
I solved it with File
-> Invalidate Caches/Restart
.
我用File
->解决了它Invalidate Caches/Restart
。
回答by KgaboL
I was getting the same error and the reason was that in my application the targetSdkVersion was set to version I didn't have setup on my AndroidStudio, error disappeared after I modified that, hope that helps.
我遇到了同样的错误,原因是在我的应用程序中 targetSdkVersion 设置为我没有在我的 AndroidStudio 上设置的版本,修改后错误消失了,希望有帮助。
回答by Sagar Devanga
Check the Android manifest file to see if you have specified this
检查Android清单文件,看看你是否指定了这个
<uses-sdk android:minSdkVersion="integer"
android:targetSdkVersion="integer"
android:maxSdkVersion="integer" />
If not then add this, it solved the error for me.
如果没有,那么添加这个,它为我解决了错误。
回答by Ankit Sharma
Check the package name is correctly set in applicationId
in file app\build.gradle
检查包的名称是否正确设置applicationId
文件app\build.gradle
回答by Mr. Suryaa Jha
Top menu bar on the left side of the AVD Manager button you have a "Sync Project with Gradle Files" button. Click that. Android Studio may become sluggish for like 5 seconds, but you'll also see a loading wheel in the project files tab, and possibly a yellow bar on the top of activity_main.xml tab saying that Gradle is syncing. In about 5 seconds everything will be up to date, and you will see the device as expected. Hope this helps.
AVD 管理器按钮左侧的顶部菜单栏有一个“将项目与 Gradle 文件同步”按钮。单击那个。Android Studio 可能会变得缓慢大约 5 秒钟,但您还会在项目文件选项卡中看到一个加载轮,并且可能在 activity_main.xml 选项卡顶部有一个黄色栏,表示 Gradle 正在同步。大约 5 秒后,一切都会更新,您将按预期看到设备。希望这可以帮助。
This really works
这确实有效
If it says Gradle Sync failed then download the missing platforms and platforms and then restart
如果它说 Gradle Sync failed 然后下载缺少的平台和平台,然后重新启动
It worked for me..
它对我有用..
回答by varadharaman
Close the emulator if it is previously opened. Then try launching the fragment_main.xml again in design mode.
如果之前打开过模拟器,请关闭它。然后尝试在设计模式下再次启动 fragment_main.xml。
回答by real 19
Restart Android Studio and it should solve the problem
重启 Android Studio 应该可以解决问题
回答by Naveen Kumar
You just make sure your right top corner api selection is below api 18 or 18 I think it will work or you will goto graphics layout and see the top corner and change
您只需确保右上角的 api 选择低于 api 18 或 18 我认为它会起作用,否则您将转到图形布局并查看顶角并进行更改