Theme.AppCompat.Light.NoActionBar not found on Android Studio
Asked Answered
B

4

8

Sorry maybe this is not new topic, but really need help, i was try many post about this, but my problem still not fix, i am newbie about android. I try to learn Material Design, i use android lollipop, API level 22.

i try to use compile 'com.android.support:support-v4:22.0.0'. After sync the gradle, i still not able to use Theme.AppCompat.Light.NoActionBar as my theme on style.xml file. This is my completely gradle file:

apply plugin: 'com.android.application'
 android {
    compileSdkVersion 22
    buildToolsVersion '22.0.1'

    defaultConfig {
        applicationId "afnan.project.com.materialdesign"
        minSdkVersion 21
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
 dependencies { 
 compile fileTree(dir: 'libs', include: ['*.jar'])
 com.android.support:support-v4:22.0.0'
} 

is there another settings so i can try to use this theme, or what is the main problem? pls tell me, Need advice..

Bramble answered 14/7, 2015 at 8:38 Comment(0)
H
6

Theme Theme.AppCompat.* is used to define compatibility with old android 2.x versions. this requires the support-v7

If you need compatibility with android 2.2 or 2.3 include this in your gradle build

 compile 'com.android.support:support-v7:22.0.0'

or if you build is for android-3.0 or later replace AppCompat with Holo.

Example

  • Theme.AppCompat.Light.NoActionBar

becomes

  • Theme.Holo.Light.NoActionBar
Hidden answered 14/7, 2015 at 8:59 Comment(2)
Thanks for your great information @k3b, it's basic question, is material design can created from all kind of parent theme, for example, android:Theme.Holo.Light.NoActionBar? And with resource which i have, can i use it to start to learn material design? Sorry still learn..Bramble
i have no knowledge about material designHidden
K
3

Previously it was

<style name="LaunchTheme" parent="@android:style/Theme.AppCompat.Light.NoActionBar">

now

<style name="LaunchTheme" parent="Theme.AppCompat.Light.NoActionBar">

Karlee answered 23/5, 2023 at 16:48 Comment(1)
it worked for me <3 Mine was flutter projectCoaster
S
0

To use the AppCompat Theme you have to include this library in your project.

 compile 'com.android.support:appcompat-v7:22.2.0'

Also I suggest you using the latest version 22.2.0 instead of 22.0.0

dependencies { 
     compile fileTree(dir: 'libs', include: ['*.jar'])
     compile 'com.android.support:appcompat-v7:22.2.0'

     //You can remove this line, because the appcompat has the support-v4 as dependency
     //com.android.support:support-v4:22.0.0'
    } 
Soulful answered 14/7, 2015 at 10:1 Comment(0)
M
0

In Android Studio Right click on Gradle and right click of mouse button Refresh Gradle project issues is resolved .

Muniment answered 1/8, 2019 at 10:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.