Android - 前缀 "xmlns" 不能显式绑定到任何名称空间; "xmlns" 的命名空间也不能显式绑定到任何前缀

Android - The prefix "xmlns" cannot be bound to any namespace explicitly; neither can the namespace for "xmlns" be bound to any prefix explicitly

有人遇到这个 "xmlns" 命名空间问题吗(见下文)?我无法再构建我的工作项目了。

注意:问题似乎与 Android Gradle merged Values.xml uses wrong namespace 类似,但我找不到未使用的命名空间。我 运行 进行了检查,但没有找到未使用的命名空间。

在我的例子中,删除 com_crashlytics_export_strings.xml 文件修复了这个错误。

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources>
<!--
  This file is automatically generated by Crashlytics to uniquely 
  identify individual builds of your Android application.

  Do NOT modify, delete, or commit to source control!
-->
<string xmlns:ns0="http://schemas.android.com/tools" name="com.crashlytics.android.build_id" ns0:ignore="UnusedResources,TypographyDashes" translatable="false">xxxxxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</string>
</resources>

我能够通过 'editing' 我的 build.gradle 罚款(删除 space 等)和 THEN 清理我的构建。如果没有先编辑 gradle 构建文件,Android Studio 不会获取更改。

您需要从 main\res\values\style 中删除所有 xmlns:android="http://schemas.android.com/apk/res/android" .xml 文件 style 标签。 您的 style.xml 文件应该是这样的:(确保您的样式标签中没有 xmlns 字段)

<resources xmlns:android="http://schemas.android.com/apk/res/android">
    <style name="AppBaseTheme" parent="android:Theme.Light">
    </style>
    <style name="AppTheme" parent="AppBaseTheme">
    </style>

    <style name="RadioButton" parent="@android:style/Widget.CompoundButton">
        <item name="android:button">@null</item>
        <item name="android:padding">5dp</item>
    </style>

    <style name="EditText" parent="@android:style/Widget.EditText">
        <item name="android:textSize">15sp</item>
    </style>
</resources>