简体   繁体   中英

First app in android studio, R class

I've install android studio for learning developing apps in Android. I've installed newest Java and android studio but in first generated Hello world project, I have many issues with R class. Android version for rendering is 5.1.1.

When I click on activity_main.xml , I don't have smartphone illustration for design. There is the following error:

NOTE: This project contains Java compilation errors, which can cause rendering failures for custom views.
Fix compilation problems first.  The following classes could not be instantiated:
- android.support.v7.internal.widget.ActionBarOverlayLayout (Open Class, Show Exception, Clear Cache)

Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE  Exception Details 
java.lang.NoClassDefFoundError: Could not initialize class android.support.v7.internal.widget.ActionBarOverlayLayout   at 
java.lang.reflect.Constructor.newInstance(Constructor.java:422)   at 
android.view.LayoutInflater.inflate(LayoutInflater.java:482)   at 
android.view.LayoutInflater.inflate(LayoutInflater.java:414)   at 
com.android.layoutlib.bridge.bars.BridgeActionBar.<init>(BridgeActionBar.java:84)   at 
com.android.layoutlib.bridge.bars.AppCompatActionBar.<init>(AppCompatActionBar.java:56)

How can I resolve this error?

在“预览”标签中,只需将“预览版本”从“自动选择最佳”更改为“ 21”,它应该可以正常工作。

Update your SDK Android or change version rendering on smaller 在此处输入图片说明

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