Android Studio 生成APK的时候由于xml的namespace原因不能打包成功

转载自:https://blog.csdn.net/csdndouniwan/article/details/52396364

Error: Suspicious namespace and prefix combination [NamespaceTypo] when I try create Signed APK

Error:(6) Error: Suspicious namespace and prefix combination [NamespaceTypo]
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Explanation for issues of type "NamespaceTypo":
   track these down.
   xmlns:app="http://schemas.android.com/tools"
   obscure error messages. This check looks for potential misspellings to help
   Accidental misspellings in namespace declarations can lead to some very

This is fragment of this layout file:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:fab="http://schemas.android.com/apk/res-auto"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    xmlns:app="http://schemas.android.com/tools"
    app:layout_behavior="@null"
    android:layout_gravity="bottom|right">

解决方案:
前两行xml代码是不正确的。整个xml文件应该如下:前2行是声明的xml文件。虽然你可以查看页面的实际布局在设计视图中,布局itslef在建时仍会有问题,因为它需要xml工具标签。这个名称空间的目的是能够在XML文件中记录信息,并且这些信息被当应用程序打包,这样没有运行时或者下载大小处罚。它是一个专用的AndroidXML名称空间。希望这有助于:)
原文:
Your first two lines of the xml code are incorrect. The whole xml file should look as follows:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/tools"
app:layout_behavior="@null"
android:layout_gravity="bottom|right">


The first 2 lines are the declaration of the xml file. Although you are able to view the actual layout of the page in the design view, the layout itslef would still have issues when being built since it needs the xml tools tag.

The purpose of this namespace is to be able to record information in XML files, and have that information stripped when the application is packaged such that there is no runtime or download size penalty. It is a dedicated Android XML namespace.

Hope this helps :)

解决方案:
更改代码xmlns:应用="http://schemas.android.com/tools"与此:它使我的工作。
原文:
change the code xmlns:app="http://schemas.android.com/tools" with this:

xmlns:app="http://schemas.android.com/apk/res-auto"

It made mine work.
 

总结一下:

也就是说改一下布局文件的xmlns:app="http://schemas.android.com/tools" with this: 改成 xmlns:app="http://schemas.android.com/apk/res-auto"

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值