简体   繁体   中英

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. 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. 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). 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"

In [project]>app>src>main>res>values>styles.xml add 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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