Search code examples
eclipseadtandroid-5.0-lollipopandroid-lintandroid-appcompat

Error android:layout_marginEnd with appcompat v7 library


I got this error:

removing attribute http://schemas.android.com/apk/res/android:layout_marginEnd from <ImageView>

from the abc_activity_chooser_view.xml XML file when compiling the appcompat v7 library in my Android project.

Things I have tried:

  1. Uninstall Eclipse Luna and Android SDK completely.
  2. Re-install Eclipse Luna and Android SDK.
  3. Install the require Android components via Android SDK Manager.
  4. In Eclipse, ask Android Lint to ignore the error in Preferences and Skip Library Project Dependencies.
  5. Clean and build all projects.
  6. Add -clean directive to eclipse.ini file.

But without any success.

Tools I used are:

  • OS: Window 7 64-bit
  • IDE: Eclipse Luna Service Release 2 (v4.4.2) Build 20150219-0600 64-bit
  • Android SDK: Android v5.1.1 (API Level 22)
  • ADT: v23.0.6.1720515
  • Android SDK Tools: v24.1.2
  • Android SDK Platform Tools: v22
  • Android SDK Build Tools: v22.0.1
  • Android Support Repository: v12
  • Android Support Library: v22

Does anyone have any suggestion on how to fix, or workaround this error till Google fix this error?

I can't deploy my Android package until this error is fixed.

Thanks for any help.


Solution

  • To fix the android:layout_marginEnd error, within Eclipse, open the project.properties file within the appcompat v7 library and add the following directives:

    target=android-21
    sdk.buildtools=21.1.2
    

    Note: You may need to install the Android SDK Build Tools v21.1.2 [if you haven't already] via the Android SDK Manager.

    For those wishing to support Android 5.1+ (API 22) in your Android apps, you can add the following directives to the project.properties file of each of your Android project:

    target=android-22
    sdk.buildtools=22.0.1
    

    Note: You may need to install the Android SDK Build Tools v22.0.1 [if you haven't already] via the Android SDK Manager.

    So, in essence, you're using one version of the Android SDK Build Tools to build your Android apps, and another to fix the android:layout_marginEnd error in the appcompat v7 library.

    The documentation for the sdk.buildtools directive is here. The documentation also include info on how to setup the buildToolsVersion directive in the build.gradle file for those using Android Studio and Gradle.