0

This question is a duplicate of Failed to load AppCompat ActionBar with unknown error in android studio

But I am getting the same error again for API 28. My build.gradle looks like this:

    apply plugin: com.android.application
android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.android.application"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 3
        versionName "1.3"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug{
            ext.enableCrashlytics = false
            ext.alwaysUpdateBuildId = false
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
    implementation 'com.android.support:animated-vector-drawable:28.0.0-alpha3'
    implementation 'com.android.support:support-media-compat:28.0.0-alpha3'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.jjoe64:graphview:4.2.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'
    implementation files('libs/graphview-4.2.2-javadoc.jar')
}

What is the fix for this?

2 Answers2

3

USE implementation 'com.android.support:support-media-compat:28.0.0-alpha1' instead implementation 'com.android.support:support-media-compat:28.0.0-alpha3'.

  • This answer seems to be effective as on 30/07/18 - all libraries above 28.0.0-alpha1 result in the error described by the OP - this includes 28.0.0-alpha3 and 28.0.0-beta01. – kilokahn Jul 30 '18 at 03:51
  • It also works for me. Version `28.0.0-beta01` still has the same problem. –  Aug 04 '18 at 04:58
  • rc01 and rc02 has still the same issue. – Highriser Sep 14 '18 at 12:50
-1

In your Gradle file use :

compile 'com.android.support:appcompat-v7:26.0.0'
buildToolsVersion '26.0.0' 
classpath 'com.android.tools.build:gradle:3.0.0-alpha8
souki
  • 1,305
  • 4
  • 23
  • 39
  • It produces the error "This support library should not use a different version (26) than the compileSdkVersion (28)". Though the project gets compiled it still does not show the action bar. – Karan Bhatia Jul 25 '18 at 05:13
  • Can you please explain how your solution works and why it does? – kilokahn Jul 30 '18 at 03:41