Android的摇篮合并Values​​.xml使用错误的命名空间 [英] Android Gradle merged Values.xml uses wrong namespace

查看:543
本文介绍了Android的摇篮合并Values​​.xml使用错误的命名空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个项目转换到Android编译系统,每当我试图编译我得到这个错误的过程。

In the process of converting a project to the Android build system I get this error whenever I attempt to compile.

摇篮:错误解析XML:preFIX不能绑定到保留的命名空间的名称之一

合并后的values​​.xml文件包含以下根元素:

The merged values.xml file contains the following root element:

<资源的xmlns:NS1 =htt​​p://www.w3.org/2000/xmlns/>

这是什么错误的原因和如何能解决吗?

What is the cause of this error and how can it be fixed?

推荐答案

我只花了约2小时通过的Git挖提交,痛彻摇篮建设。这次提交包含超过200个已更改的文件与4000+修改的行。你可以想像它是多么有趣了;)

I just spent around 2 hours digging through the Git commit that broke our Gradle build. This commit contained over 200 changed files with 4000+ modified lines. You can imagine how much fun it was ;)

总之,这里是什么我们造成这种模糊的摇篮错误:有些款式有一个的xmlns:定制属性是在 RES /值定义/ styles.xml

Anyway, here is what caused this obscure Gradle error for us: Some styles with a xmlns:custom attribute were defined in res/values/styles.xml:

<style name="content" xmlns:custom="http://schemas.android.com/apk/res-auto">
    <item name="android:textSize">14sp</item>
    <item name="android:textColor">@color/content</item>
</style>

正如你可以看到自定义命名空间甚至不使用。出于某种原因,蚂蚁和ADT构建没在意这个属性,但摇篮:processDebugResources 任务barfed一个不是非常有帮助的错误信息

As you can see the custom namespace is not even used. For some reason the Ant and ADT builds did not care about this attribute, but the Gradle :processDebugResources task barfed with a not very helpful error message.

删除的xmlns:定制=htt​​p://schemas.android.com/apk/res-auto固定它

版本中使用:摇篮1.10和com.android.tools.build:gradle:0.8.0

Versions used: Gradle 1.10 and 'com.android.tools.build:gradle:0.8.0'

这篇关于Android的摇篮合并Values​​.xml使用错误的命名空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆