6

I'm new to android studio and I have a new version installed (version 1.5.1). For some reason I keep getting an error message (every time I use an app theme) saying that there were rendering problems: styles missing. I looked online for solutions, but most of them are outdated or just do not work.

An image of the error

Thanks for any help.

Manifest file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.easycodingplus.myapplication">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

Build gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.easycodingplus.myapplication"
        minSdkVersion 8
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
}
Yaron
  • 173
  • 2
  • 12

7 Answers7

4

just change your style.xml file like this

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

and then, go to

File > Project Structure > app >

and set (both should be same with latest version )

source compatibility : 1.7

Target compatibility : 1.7

Ajay P. Prajapati
  • 1,973
  • 1
  • 17
  • 34
  • I just changed the `Target` and `Source` compatibility from blank to 1.7 and then the screen loaded fine. Thanks – Jethro Feb 02 '16 at 13:20
0

Please ensure you have the lateset AppCompat library listed as a dependency in your build.gradle file:

com.android.support:appcompat-v7:23.1.0

Can you post which style the error is referring to? You may need to add a style to your res > values > styles folder. Something in your code is probably referencing a style that does not exists in that folder.

tccpg288
  • 3,242
  • 5
  • 35
  • 80
  • Thank you, but this didn't help. I have "compile 'com.android.support:appcompat-v7:23.1.1'" and it still doesn't work. – Yaron Jan 13 '16 at 17:41
0

you have to include the dependencies for design which is like this, this will be added under the dependencies block of the app module of the build.gradle

compile 'com.android.support:design:23.1.1'

it should be something like this ..

you need this support library as CoordinatorLayout, AppBarLayout and FloatingActionButton part of it

enter image description here

make a style in the style file

<style name="AppTheme" parent="Base.Theme.AppCompat.Light">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>

and reference that in your AndroidManifest file

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:largeHeap="true"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">// like this
Pankaj Nimgade
  • 4,529
  • 3
  • 20
  • 30
0

try this way:

keep your internet connection

go to "file" in android studio toolbar click on "invalidate caches/Restart" and choose "invalidate and restart"

mehrdad khosravi
  • 2,228
  • 9
  • 29
  • 34
0

I also faced the same problem so what I did...go to sdk manager -->tick android 5.1.1 api level 22 and installed it.... tick android 5.1.1 api level 22 and installed it.. then go to Preview window and select other version

then go to Preview window and select other version

0

3 options

1.Select low-level API version

I have 23 but you can go for 19 or 21

2.Add Base on styles.xml

select theme from AppTheme or dealer here

3.Install previous SDK (if you want)

-1

I faced the same problem and these steps helped me solve it: 1. File > Other settings > Default Settings > Appearances & Behaviour > File encoding. 2. Change project encoding to windows-1252. Then: 3. File > Invalidate Chaches/Restart. OR WORST CASE Change the theme to Material light or something else, one of them should work. I hope this helps.

NCS
  • 1
  • 1