android studio调试报错:java.lang.RuntimeException: Unable to start activity ComponentInfo

时间:2022-01-12 02:20:56

报错信息:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.pro_u_loc/com.example.pro_u_loc.signActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.

报错截图:

android studio调试报错:java.lang.RuntimeException: Unable to start activity ComponentInfo

真机调试结果:

点击按钮自动弹出软件并报错日志。

错误原因:

login_activity中,一个按钮的id使用了main_activity中的id

修改:

将login_activity中的按钮换为它自己的id:

Button sign1 = findViewById(R.id.zhuce);

因为Android studio很多时候按钮功能非常相似,你点击的时候出现的.id不止当前页面的按钮id,所有界面的id都出现啦,很有可能不留神就点错误了。

如何查看自己错误原因:
我在手机上调试的时候,手机日志有一行:
loginacticity (48),在我所知道.java文件中,48行出现问题。所以就找到问题原因了。
 

android studio调试报错:java.lang.RuntimeException: Unable to start activity ComponentInfo的更多相关文章

  1. java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ex.activity/com.ex.activity.LoginActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class

    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ex.activity/com.ex.activity.L ...

  2. Android开发中java.lang.RuntimeException: Unable to start activity ComponentInfo{xxx}

    Android开发中java.lang.RuntimeException: Unable to start activity ComponentInfo{xxx}: java.lang.NullPoi ...

  3. java.lang.RuntimeException: Unable to instantiate activity ComponentInfo异常总结

    java.lang.RuntimeException: Unable to instantiate activity ComponentInfo异常总结 做android开发的可能都碰到"j ...

  4. java.lang.RuntimeException: Unable to start activity ComponentInfo

    异常:java.lang.RuntimeException: Unable to start activity ComponentInfo{com.william/com.william.Result ...

  5. 转载java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.spinner/com.example.spinner.MainActivity}: java.lang.NullPointerException

    今天学习Android开发突然遇到了这个问题,查阅了很多资料,并且对集中原因进行了分析. 错误信息字符串:java.lang.RuntimeException: Unable to start act ...

  6. java.lang.RuntimeException: Unable to start activity ComponentInfo……AppCompat does not support the current theme features

    Android测试时出现闪退的问题,出现了如下所示异常: java.lang.RuntimeException: Unable to start activity ComponentInfo{thon ...

  7. Java.lang.RuntimeException: Unable to instantiate activity ComponentInfo

    如果你更新了ADT的新版本,而工程文件中使用了其他的jar包,也可能会出现"java.lang.RuntimeException: Unable to instantiate activit ...

  8. hive 报错 java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient

    Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: Unable ...

  9. java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.love5/com.example.love5.Main11Activity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.

    若有 java.lang.RuntimeException和 java.lang.NullPointerException: Attempt to invoke virtual method 'voi ...

随机推荐

  1. shell获取ip

    ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:"

  2. php 连续留存与留存人数计算

    for($i = 0;$i <= $interval;$i++) { $res = $model->turnround($today,$tomorrow,$flag); $temp = a ...

  3. mysql系统库INFORMATION&lowbar;SCHEMA&comma;MySQL&comma;TEST&comma;mysql系统表的作用

    本文简要说明了MySQL数据库安装好后自带的INFORMATION_SCHEMA,MySQL,TEST三个数据库的用途. 第一个数据库INFORMATION_SCHEMA: 提供了访问数据库元数据的方 ...

  4. 笔记本win7制作wifi

    笔记本win7系统, 要打开笔记本无线网卡 1. 运行 netsh wlan set hostednetwork mode=allow ssid=testwifi key=testpass model ...

  5. HDU-1028 Ignatius and the Princess III&lpar;生成函数&rpar;

    题意 给出$n$,问用$1$到$n$的数字问能构成$n$的方案数 思路 生成函数基础题,$x^{n}$的系数即答案. 代码 #include <bits/stdc++.h> #define ...

  6. redis发布&sol;订阅

    发布订阅简介 Redis 发布订阅(pub/sub)是一种消息通信模式:发送者(pub)发送消息,订阅者(sub)接收消息,消息之间通过channel传递. 准备工作 两台安装了redis的机器(虚拟 ...

  7. 关于PHP函数传参的注意点

    PHP的实参在传递过程中是顺序传递的,不支持指定参数名传递.怎么理解呢?看下面的代码: function test($name,$age){ echo '姓名:'.$name,' 年纪:'.$age; ...

  8. 部署kubernetes1&period;8&period;4&plus;contiv高可用集群

    原理和架构图参考上一篇,这里只记录操作步骤.由于东西较多,篇幅也会较长. etcd version: 3.2.11 kube version: 1.8.4 contiv version: 1.1.7 ...

  9. MySQL8&period;0安装连接Navicat的坑

    刚在官网装好MySQL8.0后,我的cmd识别不了启动数据库的指令 需要cd到MySQL的bin目录配置mysql mysqld --install mysqld --remove mysql -u ...

  10. Git和SourceTree入门教程

    转自CSDN:http://blog.csdn.net/collonn/article/details/39259227 -->本教程适用于主流的开源网站github和bitbucket,个人认 ...