【发布时间】:2017-06-22 12:55:21
【问题描述】:
我创建了简单的 android studio 应用程序并将签名的 apk 发布到 google play 商店。该应用程序在模拟器上运行良好,这是一个非常简单的应用程序。所以没有什么应该让它崩溃。无论如何,在 Google Play 商店发布该应用程序后,我将其下载到我的其他手机上。它打开并显示所有小部件。但是当我点击按钮时它会崩溃说“不幸的是体重指数计算器已经停止。 这是我的第三个 android 应用程序,它们都得到了相同的结果。我究竟做错了什么?。我正在遵循发布签名 apk 的所有说明,并且我正在直接遵循所有 google play store 步骤。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
android:layout_marginBottom="20dp"
android:layout_marginTop="20dp"
android:gravity="top|center"
tools:context="calculator.bodyweight.www.myapplication.MainActivity">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginTop="25dp"
android:text="@string/textView2"
android:textAlignment="center"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<EditText
android:id="@+id/editTextweight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView2"
android:layout_alignStart="@+id/textView2"
android:layout_below="@+id/textView2"
android:layout_marginTop="19dp"
android:ems="10"
android:inputType="numberDecimal"
android:textAlignment="center"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/editTextHeight"
android:layout_alignStart="@+id/editTextHeight"
android:layout_below="@+id/editTextweight"
android:layout_marginTop="33dp"
android:text="@string/textView3"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<EditText
android:id="@+id/editTextHeight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/editTextweight"
android:layout_alignStart="@+id/editTextweight"
android:layout_alignTop="@+id/textView3"
android:layout_marginTop="46dp"
android:ems="10"
android:inputType="numberDecimal"
android:textAlignment="center"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/editTextHeight"
android:layout_alignStart="@+id/editTextHeight"
android:layout_below="@+id/editTextHeight"
android:layout_marginTop="16dp"
android:onClick="calculate"
android:text="@string/button"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/button"
android:layout_alignStart="@+id/button"
android:layout_below="@+id/button"
android:layout_marginTop="23dp"
android:text=""
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:srcCompat="@drawable/weight" />
</LinearLayout></ScrollView>
</RelativeLayout>
【问题讨论】:
-
你能发布你的java文件吗
-
有崩溃日志吗?
-
您是否使用
ProGuard进行发布构建?如果是这样,可能是您缺少一些配置。 -
不,我没有使用 proguard。
-
崩溃日志:java.lang.IllegalStateException: at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.resolveMethod(AppCompatViewInflater.java:327) at )
标签: android apk publish android-install-apk