skip to Main Content

I need to use Theme.AppCompat.Light.NoActionBar, but Theme.AppCompat is not found in Android Studio
how it looks

I added implementation ‘com.android.support:appcompat-v7:28.0.0’ to gradle, but the problem still the same

dependencies in gradle:

dependencies {

    implementation 'androidx.core:core-ktx:1.10.1'
    //
    implementation 'androidx.room:room-ktx:2.5.1'
    kapt "androidx.room:room-compiler:2.5.1"
    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.1'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1'
    implementation 'androidx.preference:preference-ktx:1.2.0'
    implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.google.android.material:material:1.9.0'
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.google.android.material:material:1.10.0-alpha03'
    //
    implementation 'com.google.android.material:material:1.9.0'
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.1'
    implementation 'androidx.activity:activity-compose:1.7.1'
    implementation platform('androidx.compose:compose-bom:2022.10.00')
    implementation 'androidx.compose.ui:ui'
    implementation 'androidx.compose.ui:ui-graphics'
    implementation 'androidx.compose.ui:ui-tooling-preview'
    implementation 'androidx.compose.material3:material3'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
    androidTestImplementation platform('androidx.compose:compose-bom:2022.10.00')
    androidTestImplementation 'androidx.compose.ui:ui-test-junit4'
    debugImplementation 'androidx.compose.ui:ui-tooling'
    debugImplementation 'androidx.compose.ui:ui-test-manifest'
}

I added implementation ‘com.android.support:appcompat-v7:28.0.0’ to gradle, but the problem still the same

2

Answers


  1. add this library

    implementation ‘androidx.appcompat:appcompat:1.6.1’

    make sure latest should implement it will solve the problem.
    and also comment the old library

    implementation ‘com.android.support:appcompat-v7:28.0.0’

    Login or Signup to reply.
  2. the problem i think you write in your file theme.xml wrong way.
    in the "parent" of style.

    a common error when you new in android it is write like this:

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <style name="Theme.ShoppingList" parent="theme.AppCompat.Light.NoActionBar" />
    </resources>
    

    or like this:

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <style name="Theme.ShoppingList" parent="android:Theme.AppCompat.Light.NoActionBar" />
    </resources>
    

    The right way to write parent theme make sure you have like this:

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <style name="Theme.ShoppingList" parent="Theme.AppCompat.Light.NoActionBar" />
    </resources>
    

    the parent theme starts with a capital letter "Theme"

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search