java - android apk 中的错误 xml

标签 java android xml apk

我正在尝试构建计算小费价格的 Android 应用程序。 这是 xml 在 android studio 中的样子: eandroid studio

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

我导出一个调试 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 而不是 constarint 布局......我认为这应该会产生奇迹

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

关于java - android apk 中的错误 xml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45940943/

相关文章:

java - 将 json 响应转换为自定义类时出错

Java 在 Eclipse 中运行但在 Netbeans 中无法成功打开文件

java - 在 jacoco 覆盖率报告中排除文件夹

java - 如何使底部工作表对话框的角变圆?

android - 如何检索从 Google Glass 安装的 apk 文件?

javascript - 如何在odoo中添加CSS和javascript?

java - 正在调用被识别为 'static member' 的模拟类,但在测试中它没有被识别为模拟类?

javascript - 将表单数据转换为 XML 并将其提交给服务器

php - 如何使用 XMLReader 读取具有未定义命名空间的 XML 文件?

android - 套接字:Android到Unity,可能会遭到分配攻击吗?