Failed to Load Appcompat Actionbar with Unknown Error in Android Studio

Failed to load AppCompat ActionBar with unknown error in android studio

The solution to this problem depends on the version of the Android support library you're using:

Support library 26.0.0-beta2

This android support library version has a bug causing the mentioned problem

In your Gradle build file use:

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

with:

buildToolsVersion '26.0.0' 

and

classpath 'com.android.tools.build:gradle:3.0.0-alpha8'

everything should work fine now.


Library version 28 (beta)

These new versions seem to suffer from similar difficulties again.

In your res/values/styles.xml modify the AppTheme style from

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

to

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

(note the added Base.)

Or alternatively downgrade the library until the problem is fixed:

implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'

Failed to load AppCompat ActionBar with unknown error.Android Studio 3.1.3

Please change com.android.support:appcompat-v7:28.0.0-alpha3 to com.android.support:appcompat-v7:28.0.0-alpha1 in build.gradle(Module: App).

And click File -> Invalidate Caches / Restart

Of course you need internet access.

It seems there is a bug in com.android.support:appcompat-v7:28.0.0-alpha3

How to fix Failed to load AppCompat ActionBar with unknown error. for api 28?

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

Failed to load AppCompat ActionBar with unknown error

I met the same problem recently despite it being a wizard simple project.

I tried with 23 level (Mashmallow) without any changes. I uninstalled Android Studio, reinstalled it, it made no changes, error was still there...

Then I realized the problem was coming from a dependency (probably recently updated from Google with an error). The solution is to use the previous release.

Go to File -> Project Structure -> Modules app -> Dependencies Tab. The default used by wizard during project creation is com.android.support:appcompat-v7:28.0.0-alpha3

Simply modify to com.android.support:appcompat-v7:27.1.1

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

I had the same problem. I searched so much and I finally found that appcompat-v7:28.0.0-alpha3 has some bug with "Design View" part of Android Studio.

So I suggest to change com.android.support:appcompat-v7:28.0.0-alpha3 to com.android.support:appcompat-v7:28.0.0-alpha1 version and then click File -> Invalidate Caches / Restart. Volla everything is OK.

Of course you should have internet access to download com.android.support:appcompat-v7:28.0.0-alpha1

Failed to load AppCompat ActionBar with unknown error android studio 3.0

First, you need to use the same version of compileSdkVersion, buildToolsVersion, targetSdkVersion, and support library version. I see that you want to use buildToolsVersion '26.0.2'. So, change all of them to version 26.

Second, you need to clean up your build.gradle. There is no need for duplicate dependencies.

Third, try clean and build your project. As the last resort, try File -> Invalidate Caches/Restart...

Your app build.gradle should be something like this:

apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId 'com.halloo'
minSdkVersion 16
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'
}
}
productFlavors {
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
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.squareup.okhttp3:okhttp:3.5.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.mikhaellopez:hfrecyclerview:1.0.0'
testCompile 'junit:junit:4.12'
}

You also need to check for your project build.gradle. It should contain build:gradle:3.0.0 (as @dheeraj-joshi has pointing out), something like this:

buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}

allprojects {
repositories {
jcenter()
mavenCentral()
// maven { url "https://maven.google.com" }
google()
}
}


task clean(type: Delete) {
delete rootProject.buildDir
}

Then, you need to check your gradle version. It should at least using gradle-4.1.



Related Topics



Leave a reply



Submit