ERROR :rendering problems The following classes could not be found android.suppo

针对Android Studio中出现的布局渲染错误,特别是找不到ActionBarOverlayLayout类的问题,本文提供了几种解决方案,包括修改主题、更新依赖和调整API级别。

ERROR :rendering problems The following classes could not be found android.support.v7.internal.widget.ActionBarOverlayLayout

 

I am just a beginner to android app development. When i created a new project on Android Studio 1.1.0, it gives up this error "rendering problems The following classes could not be found android.support.v7.internal.widget.ActionBarOverlayLayout"

Now i have searched about this on google, and i found possibly 3 solutions given by most of the people.

They say:

  1. Either change the api (from preview window pane) from 22 to 21, or

  2. Change the App Theme from "Project Theme" to any other theme.

  3. be sure to have imported right appcompat-v7 library in your project structure -> dependencies,Refer these steps: Add the support library feature project identifier to the dependencies section. For example, to include the appcompat project add compile "com.android.support:appcompat-v7:18.0.+" to the dependencies section, as shown in the following example:

dependencies {
    ...
    compile "com.android.support:appcompat-v7:18.0.+" }

Note: My android support lib is up-to-date (installed it using SDK Manager).

Following first two steps, removed the error. But I feel that these are not the permanent solutions, the Second step seems just like a temporary workaround. I have doubts about the First step also, that if to remove the error, we change api from 22 to 21, then at the end, our app wont work in Android 5.1.1(API 22), it would be restricted to Android 5.0.1 and below only (API 21). Are my doubts valid? Regarding the third step, is it the permanent solution to this problem?

P.S : Sorry for mismatching tags, wasn't allowed to add exact tags due to site reputation

share improve this question
 
   
Thanks for self answering question. Changing the theme worked for me –   eMAD  May 1 at 8:13
   
@eMAD :D Thats just a temporary solution man!! I hope somebody gives us a permanent answer! –  Ashish Goyal  May 2 at 9:22
   
For me, even the first two steps don't solve the problem... I'm getting "rendering problems" with all layouts that have views from android.support.*. This is frustrating! –   user1987392  May 2 at 17:09

5 Answers

Fix res/values/styles.xml like so:

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

Detailed explanation as requested: Theme.AppCompat.Light.DarkActionBar is a subclass of the superclass Base anyway. Ctrl+click (Android Studio) on it and you will be taken to the source:

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

We didnt change anything, we just defined it more precisesly.

share improve this answer
 
1 
This answer could benefit from a sentence. –   Josh C  May 3 at 17:18
   
Could you please share why it has to be done this way or point to the resource? –   Pejs  May 4 at 0:43
   
Expanded my answer. Inheritance between classes is a fundamental part of Java. –   eee  May 4 at 1:04
   
Wow, what a lame out of box experience in Android Studio. –   Warren P  May 17 at 4:09

Modify src/res/values/styles.xml

<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar"></style>

Then select API22, you'll find this problem fixed!

share improve this answer
 
   
works fine, thnx a lot –   Ivan Black  May 17 at 7:46

You don't need to change the theme. Maybe your're extending ActionBarActivity (deprecated) instead of just Activity. Change it, and build the project.

share improve this answer
 

La solucion a este problema es facil simplemente tienes que actualizar tu SDK, abre sdk manager instala todos los tool, extras y actualizaciones que tengas pendientes una vez instalado cierra y abre el android studio y tu problema se solucionado

share improve this answer
 
   
post your question in english please.. –   bakriOnFire  May 20 at 12:41 

If you do change the activity from ActionBarActivity to just Activity, don't forget to import the Activity itself. That is

import android.app.Activity

It sucks but hey, it's their fault and not ours.

Also you can simply change the theme by pressing the "AppTheme" and choose Holo.Light.DarkActionBar. It updates the styles.xml file automatically.After that, rebuild the project.

I did all these and it works for me though i think them guys at Google and IntelliJ should do something about this rendering problem since we have been told to move from Eclipse to Android Studio

share improve this answer
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值