【问题标题】:Error android:layout_marginEnd with appcompat v7 library错误 android:layout_marginEnd 与 appcompat v7 库
【发布时间】:2015-04-13 05:35:42
【问题描述】:

我收到了这个错误:

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

在我的 Android 项目中编译 appcompat v7 library 时来自 abc_activity_chooser_view.xml XML 文件。

我尝试过的事情:

  1. 完全卸载 Eclipse Luna 和 Android SDK。
  2. 重新安装 Eclipse Luna 和 Android SDK。
  3. 通过 Android SDK Manager 安装所需的 Android 组件。
  4. 在 Eclipse 中,要求 Android Lint 忽略 Preferences 和 Skip Library Project Dependencies 中的错误。
  5. 清理并构建所有项目。
  6. -clean 指令添加到eclipse.ini 文件中。

但没有任何成功。

我使用的工具是:

  • 操作系统:Window 7 64 位
  • IDE:Eclipse Luna Service Release 2 (v4.4.2) Build 20150219-0600 64 位
  • Android SDK:Android v5.1.1(API 级别 22)
  • ADT:v23.0.6.1720515
  • Android SDK 工具:v24.1.2
  • Android SDK 平台工具:v22
  • Android SDK 构建工具:v22.0.1
  • Android 支持存储库:v12
  • Android 支持库:v22

在 Google 修复此错误之前,是否有人对如何修复或解决此错误有任何建议?

在修复此错误之前,我无法部署我的 Android 包。

感谢您的帮助。

【问题讨论】:

  • Google 似乎需要发布 ADT 的更新版本来解决此问题。
  • @CKDPublishing:我找到了解决方案 - 请参阅下面的答案。

标签: eclipse adt android-5.0-lollipop android-lint android-appcompat


【解决方案1】:

要修复 android:layout_marginEnd 错误,请在 Eclipse 中打开 appcompat v7 库中的 project.properties 文件并添加以下指令:

target=android-21
sdk.buildtools=21.1.2

注意:您可能需要通过 Android SDK 管理器安装 Android SDK Build Tools v21.1.2 [如果您还没有]。

对于那些希望在您的 Android 应用中支持 Android 5.1+ (API 22) 的用户,您可以将以下指令添加到每个 Android 项目的 project.properties 文件中:

target=android-22
sdk.buildtools=22.0.1

注意:您可能需要通过 Android SDK 管理器安装 Android SDK Build Tools v22.0.1 [如果您还没有]。

因此,从本质上讲,您正在使用一个版本的 Android SDK 构建工具来构建您的 Android 应用程序,而另一个版本用于修复 appcompat v7 库中的 android:layout_marginEnd 错误。

sdk.buildtools 指令的文档是 here。该文档还包含有关如何在 build.gradle 文件中为使用 Android Studio 和 Gradle 的用户设置 buildToolsVersion 指令的信息。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多