简体   繁体   English

为什么activity_main.xml在Android Studio中不显示我的组件,为什么28个API不起作用?

[英]Why doesn't activity_main.xml show my components in Android Studio, and why does 28 API not work?

I've recently downloaded Android Studio on a new Surface Laptop and have had a couple problems. 我最近在新的Surface Laptop上下载了Android Studio,但遇到了一些问题。 I've had a few problems that I do not know how to fix. 我遇到了一些我不知道如何解决的问题。 Right off the bat after beginning an Empty Activity, it does not display the "hello world" TextView that automatically comes with the activity. 开始执行“空活动”后立即执行操作,它不会显示该活动随附的“ hello world” TextView。 The only thing that displays is a white screen. 唯一显示的是白屏。 This is the error that is displayed: 这是显示的错误:

The following classes could not be instantiated: 以下类无法实例化:

   - android.support.v7.widget.ActionBarContainer (Open Class, Show Exception, Clear Cache)
   - android.support.v7.widget.ActionBarContextView (Open Class, Show Exception, Clear Cache)
   - android.support.v7.app.WindowDecorActionBar (Open Class, Show Exception, Clear Cache)

( I have tried to manually build the project and refresh, as the hint suggests ) (如提示所示,我尝试手动构建项目并刷新)

Also, when I try running the project on a Pixel 2, API 28 virtual device, it gets stuck at turning on the device (where you can only see the colorful "G" and the white screen behind it). 另外,当我尝试在API 28虚拟设备Pixel 2上运行该项目时,它会卡在打开设备的位置(在那里您只能看到彩色的“ G”和它后面的白色屏幕)。 In the event log, the following is displayed: 在事件日志中,显示以下内容:

Emulator: 仿真器:

ERROR: Missing initial data partition file: C:\Users\aboli\.android\avd\Pixel_2_API_28.avd/userdata.img

I've tried looking at similar problems, but haven't found anything that works. 我曾尝试研究类似的问题,但没有发现任何可行的方法。 I was hoping someone may have any suggestions or any similar experiences. 我希望有人可能有任何建议或类似的经验。 Thanks in advance 提前致谢

"Why doesn't activity_main.xml show my components in Android Studio" “为什么activity_main.xml在Android Studio中不显示我的组件”

In [project]>app>src>main>res>values>styles.xml add Base. 在[项目]> app> src> main> res> values> styles.xml中添加Base. like this: 像这样:

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

gets 得到

<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">

and your components should show. 并且您的组件应显示。 I have to do this for every new project so I have looked for a general solution, a template somewhere?, but until now to no avail. 我必须对每个新项目都执行此操作,因此我一直在寻找通用解决方案,某个地方的模板?,但直到现在都无济于事。 My Android Studio is 3.1.3 我的Android Studio是3.1.3

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM