Error When Using Any Android Design Support Library Elements

Error when using any Android Design Support Library Elements

In addition to Emmanuel's answer you could be facing the following problem.

It seems like the design library components need a style which is based on an AppCompat Theme. So try to use "Theme.AppCompat.[...]" as a parent in your style.xml.

Example:

<!-- Base application theme. -->
<style name="AppTheme" parent="Base.AppTheme">
<!-- Customize your theme here. -->
</style>

<style name="Base.AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:colorPrimary">@color/primary</item>
<item name="android:colorPrimaryDark">@color/primary_dark</item>
<item name="android:colorAccent">@color/accent</item>
</style>

Then add the following to your build.gradle as well:

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

Additionally you should update the following lines in your gradle as well:

classpath 'com.android.tools.build:gradle:1.2.3'
compileSdkVersion 22
buildToolsVersion '22.0.1'
targetSdkVersion 22

Error using Android Design Support Library: attr backgroundTint not found

I was able to fix the issue with @igece solution, but later I found out that the real issue is an outdated appcompat-v7 library.

After upgrading it to the latest version nothing had to be edited on Google's libraries.

Problem with the implementation of the Android Studio Java design libraries

With the release of Android 9.0 (API level 28) there is a new version
of the support library called AndroidX which is part of Jetpack.

You should use androidx instead of android.support libraries in your project. Using android.support libraries will prevent you from using latest play services and jetpack features.

You can refactor your project to use the androidx libraries instead by Refactor -> Migrate to androidX

Migarting your project to androidx should change your dependency com.android.support:design:25.0.1 to 'com.google.android.material:material:1.0.0'

adding com.android.support:design:28.0.0 dependency

You don't need this dependency since you are using the Material components library (it is a drop-in replacement for Android's Design Support Library).

Just remove it.

Cannot add android support library to android studio

This issue is Android studio detected 2 different versions of Android support library. The case here would be the support library version 25.3.1 in another library that you are importing.

I would suggest you don't use the alpha version (26-alpha) and change it to version 25.3.1

Android studio error This support library should not use a lower version (19)

Change

compile 'com.android.support:appcompat-v7:19.+'

to

compile 'com.android.support:appcompat-v7:20+'

first open SDK Manager and update the support Libary.
or change the targetSDKVersion to 19

the filename is 'build.gradle'

android design library gradle null pointer exception

I ran the app using android studio and not IntelliJ 14 and got a different error:

`Error:(1) Attribute "insetForeground" has already been defined`

So if someone is running IntelliJ 14, until next update of Intellij 14 I guess It's safer to use android studio 1.3.+ (or at least check for errors using android studio.

If one get the same error.

  • go to attr.xml and remove declare-styleable name="ScrimInsetsView"

  • using ctrl-shift-f search for insetF and remove app:insetForeground attribute from all the layout that contains such attribute.

Everything should work OK now

Home button not shown when using the design support library

I personnaly get the Toolbar then set it as ActionBar and use the regular methods and it works for me.

Hope it helps you:

final Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolBar);
toolbar.setTitle(R.string.foo);
toolbar.setNavigationIcon(R.drawable.bar);
setSupportActionBar(toolbar);

getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);


Related Topics



Leave a reply



Submit