Java android apk中的错误xml

Java android apk中的错误xml,java,android,xml,apk,Java,Android,Xml,Apk,我正在尝试建立android应用程序,计算小费价格。 以下是android studio中xml的外观: 这就是在我安装apk文件后,xml在我手机中的实际外观: 我导出一个调试apk文件,而不是发布。 当我尝试安装版本apk文件时,我在手机中发现一个错误,即找不到安装证书。 这是我的xml代码: <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns

我正在尝试建立android应用程序,计算小费价格。 以下是android studio中xml的外观:

这就是在我安装apk文件后,xml在我手机中的实际外观:

我导出一个调试apk文件,而不是发布。 当我尝试安装版本apk文件时,我在手机中发现一个错误,即找不到安装证书。 这是我的xml代码:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.gear.tip.MainActivity">

    <CheckBox
        android:id="@+id/checkBox7"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="No"
        tools:layout_editor_absoluteX="245dp"
        tools:layout_editor_absoluteY="349dp" />

    <CheckBox
        android:id="@+id/checkBox8"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Yes"
        tools:layout_editor_absoluteX="178dp"
        tools:layout_editor_absoluteY="349dp" />

    <TextView
        android:id="@+id/textView11"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Do you know the waiter?"
        android:textColor="#0000ff"
        android:textSize="20sp"
        tools:layout_editor_absoluteX="16dp"
        tools:layout_editor_absoluteY="284dp" />

    <TextView
        android:id="@+id/textView6"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Number of feasts:"
        android:textColor="#000000"
        android:textSize="20sp"
        tools:layout_editor_absoluteX="16dp"
        tools:layout_editor_absoluteY="137dp" />

    <TextView
        android:id="@+id/textView5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="How was the service?\nFrom 1 to 100:"
        android:textColor="#000000"
        android:textSize="20sp"
        tools:layout_editor_absoluteX="16dp"
        tools:layout_editor_absoluteY="192dp" />

    <TextView
        android:id="@+id/textView8"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Total price:"
        android:textColor="#000000"
        android:textSize="20sp"
        tools:layout_editor_absoluteX="16dp"
        tools:layout_editor_absoluteY="65dp" />

    <TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Tip calculator"
        android:textColor="#d11723"
        android:textSize="25sp"
        tools:layout_editor_absoluteX="16dp"
        tools:layout_editor_absoluteY="16dp" />

    <EditText
        android:id="@+id/editText"
        android:layout_width="123dp"
        android:layout_height="39dp"
        android:ems="10"
        android:inputType="textPersonName"
        android:text=""
        tools:layout_editor_absoluteX="245dp"
        tools:layout_editor_absoluteY="200dp" />

    <EditText
        android:id="@+id/editText3"
        android:layout_width="147dp"
        android:layout_height="39dp"
        android:ems="10"
        android:inputType="textPersonName"
        android:text=""
        tools:layout_editor_absoluteX="197dp"
        tools:layout_editor_absoluteY="129dp" />

    <EditText
        android:id="@+id/editText2"
        android:layout_width="147dp"
        android:layout_height="39dp"
        android:ems="10"
        android:inputType="textPersonName"
        android:text=""
        tools:layout_editor_absoluteX="137dp"
        tools:layout_editor_absoluteY="58dp" />

    <TextView
        android:id="@+id/textView7"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Are you stingy?"
        android:textColor="#0000ff"
        android:textSize="20sp"
        tools:layout_editor_absoluteX="16dp"
        tools:layout_editor_absoluteY="345dp" />

    <CheckBox
        android:id="@+id/checkBox"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Yes"
        tools:layout_editor_absoluteY="284dp"
        tools:layout_editor_absoluteX="313dp" />

    <CheckBox
        android:id="@+id/checkBox2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="No"
        tools:layout_editor_absoluteX="245dp"
        tools:layout_editor_absoluteY="284dp" />

    <Button
        android:id="@+id/button2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Calculate"
        tools:layout_editor_absoluteX="16dp"
        tools:layout_editor_absoluteY="437dp" />

</android.support.constraint.ConstraintLayout>


我能做些什么来修理它?(这两个问题),谢谢你们。

不要试图在发布apk时匆忙行事。尝试使用adb功能直接在您的设备上获取应用程序

我曾经尝试过一次发布apk,但它弊大于利。与ADB您有更平滑的测试基础。试试看。。。即使断开与PC的连接,应用程序仍在手机上

尝试使用xml的垂直方向的LinearLayout,而不是Constraint布局。。。我认为这应该会产生奇迹


为了使textView和EditText保持一致,请按水平顺序使用另一个线性布局

,这样基本上每个相关属性都列为
工具:
,除了在Android studio的图形编辑器中显示结果之外,它实际上什么都不做。将其更改为android:,它应该可以工作。

ConstraintLayout中缺少约束


布局编辑器允许您将小部件放置在画布上的任何位置,并使用设计时间属性(例如布局编辑器)记录当前位置。这些属性不会在运行时应用,因此如果将布局推送到设备上,小部件可能会显示在与编辑器中显示的位置不同的位置。要解决此问题,请通过从边缘连接拖动来确保小部件同时具有水平和垂直约束。

我认为您的xml设计工作不正常。您需要清理并重建项目。或者请发布您的xml,以便我们了解您的设计。我现在编辑并添加xml代码,谢谢。请回答您的问题:您的代码干净吗?e、 g.它不会改变布局上的任何内容吗?如果您没有在代码中执行任何操作(除了设置视图)并在清单中声明活动。。。在你的editori中应该是这样的,试着在没有工具的情况下把所有的东西都改成android D:有了这些工具,现在当我尝试构建apk文件时,它给了我很多错误。。。你确定我需要做的就是把工具改成android吗?我不知道你还有什么错误,但是要解决布局问题,你需要做的就是改变
工具:
。您最好的办法是为这些问题创建另一个问题。工具:layout\u editor\u absoluteX=“245dp”工具:layout\u editor\u absoluteY=“349dp”这在您的代码中不起作用,您必须再次实现,或者可以尝试使用相对布局。