0

I Work in a Android Project and, after Adroid Studio 3.0 update, the problems come around.

The preview of my activities stop showing data, the project's still building and I can install on emulator/Phone, but I couldnt' see all the changes that I made in XML layout, here's the error message:

Failed to load AppCompat ActionBar with unknown error.

and thoses errors:

- android.support.v7.widget.AppCompatImageView (Open Class, Show Exception, Clear Cache)
- android.support.design.widget.CoordinatorLayout (Open Class, Show Exception, Clear Cache)
- android.support.v7.widget.RecyclerView (Open Class, Show Exception, Clear Cache)
- android.support.design.widget.FloatingActionButton (Open Class, Show Exception, Clear Cache)
- android.support.v7.widget.Toolbar (Open Class, Show Exception, Clear Cache)
- android.support.v7.widget.AppCompatTextView (Open Class, Show Exception, Clear Cache)
- android.support.v7.widget.ActionBarContextView (Open Class, Show Exception, Clear Cache)
- android.support.v7.app.WindowDecorActionBar (Open Class, Show Exception, Clear Cache)
- android.support.v7.widget.ActionBarOverlayLayout (Open Class, Show Exception, Clear Cache)

I readed this link here and it seems to be a Gradle Problem, I tried to restored a older version of Gradle in my git repo, but the problems continues, here's my gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion '26.0.2'

    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }

    defaultConfig {
        applicationId "br.com.golfetto.golfettomobile"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "2017.11.07"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dexOptions { javaMaxHeapSize "4g" }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(path: ':componentsutils')
    compile group: 'com.google.guava', name: 'guava', version: 'r05'
    compile 'com.github.barteksc:android-pdf-viewer:2.5.1'
    compile group: 'commons-io', name: 'commons-io', version: '2.4'
    compile 'com.sackcentury:shinebutton:0.1.4'
    compile 'net.colindodd:toggleimagebutton:1.2'
    compile 'com.sackcentury:shinebutton:0.1.4'
    compile 'net.colindodd:toggleimagebutton:1.2'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support:appcompat-v7:24.2.0'
    compile 'com.android.support:design:23.4.0'
    compile 'com.android.support:support-v4:23.4.0'
    compile 'br.com.livroandroid:android-utils:1.0.2'
    compile 'com.android.support:cardview-v7:23.4.0'
    compile 'com.mikhaellopez:circularimageview:3.0.2'
    compile 'com.synnapps:carouselview:0.0.9'
    compile 'se.emilsjolander:sprinkles:1.3.1'
    compile 'com.squareup.retrofit:retrofit:1.9.0'
    compile 'com.squareup.okhttp:okhttp:2.7.5'
    compile 'com.github.d-max:spots-dialog:0.4@aar'
    compile 'com.antonionicolaspina:revealtextview:2.0'
    compile 'com.jaredrummler:material-spinner:1.0.9'
    compile 'com.google.firebase:firebase-core:9.0.2'
    compile 'com.google.firebase:firebase-messaging:9.0.0'
    compile 'junit:junit:4.12'
    compile 'com.bcgdv.asia.lib:fanmenu:1.2'
    compile 'com.google.android.gms:play-services:9.4.0'
    compile 'com.google.firebase:firebase-crash:9.4.0'
    compile 'com.android.support:recyclerview-v7:23.4.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.github.chrisbanes:PhotoView:1.2.6'
    testCompile 'junit:junit:4.12'
}

EDIT:

Just to clarify, i already tried to change the theme in styles.xml, here's the change:

<style name="AppTheme" parent="Base.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>

for those how help, I appreciate

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Guilherme Golfetto
  • 510
  • 2
  • 5
  • 25

2 Answers2

3

You need to use the same version of compileSdkVersion, buildToolsVersion, targetSdkVersion, and Support Library in your build.gradle. You need to change to something like this:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'

    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }

    defaultConfig {
        applicationId "br.com.golfetto.golfettomobile"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "2017.11.07"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dexOptions { javaMaxHeapSize "4g" }
}
dependencies {
    ...
    compile 'com.android.support:appcompat-v7:26.1.0'
    compile 'com.android.support:design:26.1.0'
    compile 'com.android.support:support-v4:26.1.0'
    compile 'com.android.support:cardview-v7:26.1.0'
    compile 'com.android.support:recyclerview-v7:26.1.0'
}

Read an article about it at Picking your compileSdkVersion, minSdkVersion, and targetSdkVersion

ישו אוהב אותך
  • 28,609
  • 11
  • 78
  • 96
0

Just clean and rebuilt your project and it will work again.

abhi
  • 45
  • 8