错误:当我尝试创建签名APK时,可疑命名空间和前缀组合[NamespaceTypo]

Art*_*tem 41 android

我搜索了我的问题,但我找不到解决方案.
当我尝试创建签名的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
Run Code Online (Sandbox Code Playgroud)

这是此布局文件的片段:

<?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">
Run Code Online (Sandbox Code Playgroud)

Suj*_*hta 136

使用以下代码更改代码xmlns:app ="http://schemas.android.com/tools":

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

它使我的工作.


Mic*_*rla 14

您的前两行xml代码不正确.整个xml文件应如下所示:

<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">
Run Code Online (Sandbox Code Playgroud)

前两行是xml文件的声明.虽然你可以查看在设计视图页面的实际布局,布局itslef还是会有问题,当在建,因为它需要的XML工具标签.

此命名空间的目的是能够在XML文件中记录信息,并在打包应用程序时剥离该信息,使得没有运行时或下载大小损失.它是一个专用的Android XML命名空间.

希望这可以帮助 :)