Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

attribute insetForeground has already be defined

after updating to the new

com.android.support:design:22.2.0

I got this error:

"attribute insetForeground has already be defined"

keep in mind that i'm using @romannurik ScrimInsetsFrameLayout.java

like image 965
Omar Abdan Avatar asked May 31 '15 09:05

Omar Abdan


3 Answers

just change

insetForeground attribute

in your attrs.xml to a different name

like image 96
Omar Abdan Avatar answered Sep 17 '22 08:09

Omar Abdan


To elaborate on Omar's answer,

The Android design support library introduced NavigationDrawer that is used together with DrawerLayout to provide means of implementing navigation etc. See here:

Android Design Support Library

The NavigationDrawer extends ScrimInsetsFrameLayout which was brought into the library.

The error in the question occurs because the insetForeground attribute was defined twice. Once is the context of the library and once when a copy of ScrimInsetsFrameLayout was brought into the project.

Options:

  1. Rename the property defined in the project (as suggested by Omar) while continuing using the local copy of ScrimInsetsFrameLayout.
  2. Remove the local copy of ScrimInsetsFrameLayout and use the one in the library instead.
  3. Remove the local copy of ScrimInsetsFrameLayout and use NavigationDrawer instead.
like image 35
HaimS Avatar answered Sep 17 '22 08:09

HaimS


You have this class ScrimInsetsFrameLayout.java in your files whereas Google already put this in the Google Android Support Design Library. Replace the ScrimInsetsFrameLayout into android.support.design.widget.NavigationView

like image 35
ajdeguzman Avatar answered Sep 18 '22 08:09

ajdeguzman