Once it comes to “Failed to load AppCompat ActionBar with unknown error” in Android Studio, styles.xml is at fault and you should change it. In addition to that, you could change the version of AppCompat as well. You don’t know your way around Android Studio and could use some help carrying out the solution? Then this article is exactly what you need.
Actions To Take
Apply Changes To Styles.XML
- Step 1: Open your project in Android Studio, look to the left, expand App and go to res > values > styles.xml.
- Step 2: In styles.xml, fins <style name=”AppTheme” parent=”Theme.AppCompat.Light.DarkActionBar”> and add Base. before Theme.AppCompat.Light.DarkActionBar. After you finish, the line should look like this: <style name=”AppTheme” parent=”Base.Theme.AppCompat.Light.DarkActionBar”>
- Step 3: See how things turn out.
Note: Alternatively, you could substitute Theme.AppCompat.Light.NoActionBar for Theme.AppCompat.Light.DarkActionBar. Following the modification, the line should look like this: <style name=”AppTheme” parent=”Theme.AppCompat.Light.NoActionBar”>.
Change The AppCompat Version
- Step 1: Open your project in Android Studio, look to the left, expand Gradle Scripts and hit Build.Gradle (Module: app).
- Step 2: Change com.android.support:appcompat-v7:28.0.0-alpha3 to com.android.support:appcompat-v7:28.0.0-alpha1.
- Step 3: Click File on the top left then pick Invalidate Caches/Restart.
Alternatively, You can also switch your AppCompat version to 27.1.1 which is a stable version of AppCompat. To do so, you must change the API SDK Level and the Compile SDK version:
- Step 1: Open your project in Android Studio, click File and pick Project Structure.
- Step 2: In Project Structure window, select Module and choose Properties. Proceed to set the Compile SDK version as 27.
- Step 3: Go to Default Config tab, set the Target SDK version to 27, select Apply and choose OK.
- Step 4: Go back to your project, look to the left, expand Gradle Scripts and hit Build.Gradle (Module: app).
- Step 5: Change ‘com.android.support:appcompat-v7:28.0.0-alpha3 to com.android.support:appcompat-v7:27.1.1. Last but not least, hit Sync Now, restart, close and re-open the project from Recent.
Is Android Studio good?
In layman’s terms, Android Studio is an Integrated Development Environment (IDE) built to develop Android apps and based on IntelliJ IDEA. Aside from code editor and developer tools, Android Studio also provides quite a few features that assist developers in enhancing productivity as they design Android apps:
- Gradle-based build system.
- Fast and feature-rich emulator.
- Unified environment for building Android apps.
- The ability to change the push code and resource without restarting.
- Extensive testing tools and frameworks
- Lint tools to detect performance, usability, version compatibility and other problems
- C++ and NDK support
- Built-in support for Google Cloud Platform which facilitates the integration of Google Cloud Messaging and App Engine.
How come Google is in charge of Android?
Google delivers professional engineering resources that Android needs to ensure competitive advantages in the software industry. To Google, Android is a full-scale product development operation and the company aims to meet the commercial arrangements required to guarantee that qualified Android-powered smartphones reach the market.
Google also supports the vitality of Android as a platform and as an open-source project. Google’s objective is to provide a thriving ecosystem around Android. Therefore, they opened the Android source code where everyone can adjust and distribute the software to meet their own purposes.
What is the role of AppCompat?
Google keeps supporting old Android versions when new ones reach the market. AppCompat is a collection of support libraries that ensure that apps developed for recent versions of Android work in old versions.
What exactly is AppCompat ActionBar?
AppCompat ActionBar appears at the top of all project’s windows when users open Android Studio AppCompat. You can add the action bar by calling requestFeature(FEATURE_SUPPORT_ACTION_BAR)/proclaiming it in a custom theme with the windowActionBar property.
How to create a new project in Android Studio?
- Step 1: Launch the Android Studio then hit Start a new Android Studio project. If you are in an opened project, select File, choose New and hit New Project to create a new one.
- Step 2: In Choose your project window, click your preferred type of project and pick Next.
- Step 3: In Configure your project window, enter the project name, the package name, the Save location, the code Language and the Minimum API level based on your preferences. Finally, hit Finish to confirm and launch a new project.
I am a Software developer with approx 4 years of experience in building various responsive and beautiful websites and apps.
Language: Ruby, Java, HTML/CSS, Android
Frameworks: Ruby on Rails, Hosting: Heroku, Godaddy
Database: Mysql, Postgres, Mongo, Oracle
Also please look on my stack overflow profile.