亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

按鈕不可點擊+點擊時應用程序崩潰

按鈕不可點擊+點擊時應用程序崩潰

蠱毒傳說 2023-08-16 09:52:37
這是崩潰錯誤 logcat,每次我在寄存器上計時時,應用程序都會崩潰。我的模擬器是 AndroidQ 模擬器設備上的 2GB RAM。2019-09-22 16:36:39.307 6454-6454/com.connex.connexsocial E/AndroidRuntime:致命異常:主進程:com.connex.connexsocial,PID:6454 android.content.ActivityNotFoundException:無法找到顯式活動類{com.connex.connexsocial/com.connex.connexsocial.LoginActivity};您是否在 AndroidManifest.xml 中聲明了此活動?在 android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1933) 在 android.app.Instrumentation.execStartActivity(Instrumentation.java:1616) 在 android.app.Activity.startActivityForResult(Activity.java:4487) 在 androidx.fragment。 app.FragmentActivity.startActivityForResult(FragmentActivity.java:676) 在 android.app.Activity.startActivityForResult(Activity.java:4445) 在 androidx.fragment。這是我的主要活動<?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:background="#7ed957"    android:padding="20dp"    tools:contet=".MainActivity">    <ImageView        android:layout_height="match_parent"        android:layout_width="match_parent"        android:src="@drawable/logo1"        android:layout_centerHorizontal="true"        android:contentDescription="@string/todo" />        <!--Button: Register-->    <Button        android:id="@+id/register_btn"        android:text="@string/register"        android:layout_above="@+id/login_btn"        style="@style/Widget.AppCompat.Button.Colored"        android:layout_width="match_parent"        android:layout_height="wrap_content" /></RelativeLayout>每次我單擊“登錄”時都什么也不做,每次我單擊“注冊”時它都會崩潰。
查看完整描述

2 回答

?
楊魅力

TA貢獻1811條經驗 獲得超6個贊

您需要在清單文件中聲明 LoginActivity,如 AndroidManifest.xml

<activity
android:name="com.connex.connexsocial.LoginActivity"
     />


查看完整回答
反對 回復 2023-08-16
?
qq_花開花謝_0

TA貢獻1835條經驗 獲得超7個贊

每當您的應用程序崩潰時,第一個調試步驟應該是檢查您的 logcat,logcat 中總是有線索。如果您檢查發布的日志,您將看到以下行:

android.content.ActivityNotFoundException:無法找到顯式活動類 {com.connex.connexsocial/com.connex.connexsocial.LoginActivity};您是否在 AndroidManifest.xml 中聲明了此活動?

從字面上看,這意味著您收到此錯誤是因為您尚未在清單中聲明該活動。

要解決此問題,只需將其粘貼到清單文件的應用程序元素中:

<activity android:name="com.connex.connexsocial.LoginActivity"></activity>

這種相同的調試模式幾乎適用于所有崩潰事件。你總能從 logcat 中得到線索。


查看完整回答
反對 回復 2023-08-16
  • 2 回答
  • 0 關注
  • 164 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號