After Updating Android studio to 3.1.2 , I get “Failed to load AppCompat ActionBar with unknown error. ”

前端 未结 9 2009
旧巷少年郎
旧巷少年郎 2020-12-31 14:54

I tried looking other similar questions on stackoverflow, they advice us to changw version of \"buildToolsVersion\" but I dont see word like that in my gradle file.

相关标签:
9条回答
  • 2020-12-31 15:12

    module app gradle file looks like this...In your file you are missing buildToolsVersion, adding this may help you

      apply plugin: 'com.android.application'
    
     android {
      //changes
      compileSdkVersion 26
    buildToolsVersion "27.0.3"
     defaultConfig {
        applicationId "com.example.dhruv.testhello"
       minSdkVersion 24
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner 
     "android.support.test.runner.AndroidJUnitRunner"
     }
     buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 
      'proguard-rules.pro'
        }
        }
     }
    
    dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    
    //changes
    compile 'com.android.support:appcompat-v7:26.0.2'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso- 
    core:3.0.2'
     }
    
    0 讨论(0)
  • 2020-12-31 15:16

    At the time of this answer Android Studio 3.1.4 is out with Android Support 28.0.0 Release Candidate(Potential Final, Beta) so please update. Well, here is a config that will certainly work for you.

    targetSdkVersion 28
    com.android.support:*:28.0.0-rc01
    

    Where * is the resource type.

    0 讨论(0)
  • 2020-12-31 15:17

    I was helped by Hossein Seifi's reply but with a change

    implementation 'com.android.support:design:28.0.0-alpha3'
    

    to

    implementation 'com.android.support:design:28.0.0-alpha1'
    

    and click File -> Invalidate Caches / Restart

    0 讨论(0)
  • 2020-12-31 15:19

    In styles.xml,

    Changing the theme from Theme.AppCompat.Light.DarkActionBar to Base.Theme.AppCompat.Light.DarkActionBar has worked for me.

    0 讨论(0)
  • 2020-12-31 15:20

    Open, res>values>styles.xml, here you will find a line:

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

    replace the line with:

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

    That means: Add the word "Base." starting the name of the parent theme.

    0 讨论(0)
  • 2020-12-31 15:32

    Open, res --> values --> styles.xml, here you will find a line like this:

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    

    change it to:

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

    In otherwords, change DarkActionBar to NoActionBar

    0 讨论(0)
提交回复
热议问题