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

lgd*_*d57 11 git android xml-namespaces gradle android-studio

是否有人遇到这个"xmlns"命名空间问题(见下文)?我不能再建立我的工作项目了.

  • 起初我以为这是我的git分支,所以我切换到原点开发和主分支 - 问题仍然存在.
  • 我清理并重建了我的项目 - 问题仍然存在.
  • 我清理并同步了我的成绩文件 - 问题仍然存在.
  • 最后我尝试重新安装Android Studio并重新创建我的git存储库 - 问题仍然存在.

    The prefix "xmlns" cannot be bound to any namespace explicitly; neither can the namespace for "xmlns" be bound to any prefix explicitly.
    Error: The prefix "xmlns" cannot be bound to any namespace explicitly; neither can the namespace for "xmlns" be bound to any prefix explicitly.
    :{project}:mergeReleaseResources FAILED
    Execution failed for task ':{project}:mergeReleaseResources'.
    > {project}/build/intermediates/incremental/mergeResources/release/merger.xml:1:61: Error: The prefix "xmlns" cannot be bound to any namespace explicitly; neither can the namespace for "xmlns" be bound to any prefix explicitly.
    
    Run Code Online (Sandbox Code Playgroud)

注意:问题类似于Android Gradle merged Values.xml使用错误的命名空间,但我找不到未使用的命名空间.我运行了一个检查,但没有找到任何未使用的命名空间.

小智 27

在我的情况下,删除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>
Run Code Online (Sandbox Code Playgroud)

  • 我在build.gradle中添加了``preBuild << {delete('src/main/res/values/com_crashlytics_export_strings.xml')}`以至少自动清除它,尽管我同意这个问题应该修复他们的结局真的. (6认同)