threadid=1: thread exiting with uncaught exception (group=0x40fca9a8)的问题
今天在项目开发中碰到了这样一个问题:
项目在Nexus5【Android 6.0】上面运行正常,在华为荣耀6【Android 4.4.2】上面运行到指定activity崩溃(不是应用启动崩溃);然后后台日志报错:
07-26 17:58:44.030: D/AndroidRuntime(10889): Shutting down VM
07-26 17:58:44.030: W/dalvikvm(10889): threadid=1: thread exiting with uncaught exception (group=0x40fca9a8)
07-26 17:58:44.050: E/AndroidRuntime(10889): FATAL EXCEPTION: main
07-26 17:58:44.050: E/AndroidRuntime(10889): java.lang.NullPointerException
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.widget.ScrollBarDrawable.setAlpha(ScrollBarDrawable.java:221)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.View.onDrawScrollBars(View.java:11439)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.View.draw(View.java:13809)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.widget.FrameLayout.draw(FrameLayout.java:467)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.widget.ScrollView.draw(ScrollView.java:1579)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.View.getDisplayList(View.java:12741)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.View.getDisplayList(View.java:12785)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.View.draw(View.java:13519)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.ViewGroup.drawChild(ViewGroup.java:3019)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2883)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.View.getDisplayList(View.java:12739)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.View.getDisplayList(View.java:12785)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.View.draw(View.java:13519)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.ViewGroup.drawChild(ViewGroup.java:3019)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2883)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.View.draw(View.java:13806)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.View.getDisplayList(View.java:12741)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.View.getDisplayList(View.java:12785)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.View.draw(View.java:13519)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.ViewGroup.drawChild(ViewGroup.java:3019)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.support.v4.widget.DrawerLayout.drawChild(DrawerLayout.java:1089)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2883)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.View.getDisplayList(View.java:12739)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.View.getDisplayList(View.java:12785)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.View.draw(View.java:13519)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.ViewGroup.drawChild(ViewGroup.java:3019)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2883)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.View.getDisplayList(View.java:12739)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.View.getDisplayList(View.java:12785)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.View.draw(View.java:13519)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.ViewGroup.drawChild(ViewGroup.java:3019)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2883)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.View.getDisplayList(View.java:12739)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.View.getDisplayList(View.java:12785)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.View.draw(View.java:13519)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.ViewGroup.drawChild(ViewGroup.java:3019)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2883)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.View.draw(View.java:13806)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.widget.FrameLayout.draw(FrameLayout.java:467)
07-26 17:58:44.050: E/AndroidRuntime(10889): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2240)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.View.getDisplayList(View.java:12741)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.View.getDisplayList(View.java:12785)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:1249)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.ViewRootImpl.draw(ViewRootImpl.java:2480)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2340)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2142)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1139)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4879)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:776)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.Choreographer.doCallbacks(Choreographer.java:579)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.Choreographer.doFrame(Choreographer.java:548)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:762)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.os.Handler.handleCallback(Handler.java:725)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.os.Handler.dispatchMessage(Handler.java:92)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.os.Looper.loop(Looper.java:153)
07-26 17:58:44.050: E/AndroidRuntime(10889): at android.app.ActivityThread.main(ActivityThread.java:5299)
07-26 17:58:44.050: E/AndroidRuntime(10889): at java.lang.reflect.Method.invokeNative(Native Method)
07-26 17:58:44.050: E/AndroidRuntime(10889): at java.lang.reflect.Method.invoke(Method.java:511)
07-26 17:58:44.050: E/AndroidRuntime(10889): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
07-26 17:58:44.050: E/AndroidRuntime(10889): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
07-26 17:58:44.050: E/AndroidRuntime(10889): at dalvik.system.NativeStart.main(Native Method)
07-26 17:58:44.245: I/System.out(10889): [CDS]close[39632]
07-26 17:58:44.245: I/System.out(10889): close [socket][/0.0.0.0:39632]
07-26 17:58:44.246: I/System.out(10889): close [socket][/0.0.0.0:39632]
07-26 17:58:44.712: D/dalvikvm(10889): threadid=20: interp stack at 0x54535000
问题原因:
scrollView中嵌套RecyclerView导致的。(为什么要在scrollView中嵌套RecyclerView,因为想要实现RecyclerVIew和上面的消息区域一块滑动)。
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_home"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:scrollbarSize="2dp"
android:scrollbarThumbVertical="@null"
android:scrollbars="vertical" > <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" > <!-- 消息/公告区域 -->
<include layout="@layout/activity_home_message" /> <!-- RecyclerView列表 -->
<android.support.v7.widget.RecyclerView
android:id="@+id/home_gridview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/home_grid_margin"
android:layout_marginRight="@dimen/home_grid_margin"
android:cacheColorHint="#00000000"
android:divider="@null"
android:listSelector="#00000000"
android:overScrollMode="never"
android:scrollbars="none" />
</LinearLayout> </ScrollView>
解决方案:
去掉ScrollView。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_home"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:scrollbarSize="2dp"
android:scrollbarThumbVertical="@null"
android:scrollbars="vertical" > <!-- 消息/公告区域 -->
<include layout="@layout/activity_home_message" /> <!-- RecyclerView列表 -->
<android.support.v7.widget.RecyclerView
android:id="@+id/home_gridview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/home_grid_margin"
android:layout_marginRight="@dimen/home_grid_margin"
android:cacheColorHint="#00000000"
android:divider="@null"
android:listSelector="#00000000"
android:overScrollMode="never"
android:scrollbars="none" /> </LinearLayout>
threadid=1: thread exiting with uncaught exception (group=0x40fca9a8)的问题的更多相关文章
- threadid=1: thread exiting with uncaught exception (group=0x40db8930)
异常信息如下: 07-26 17:23:49.521: W/dalvikvm(29229): threadid=1: thread exiting with uncaught exception (g ...
- threadid=1: thread exiting with uncaught exception (group=0xb2a86d70)
这个错误是程序运行成功,但是一在虚拟机上运行就报“停止运行了”,如图: 然后我们查看一个日志信息: 查了好久,终于 搞好了,原因是安卓目标SDK版本太高了,我这里创建好默认是这样的如图: 只要把21改 ...
- threadid=1: thread exiting with uncaught.exception ......解决方法
threadid=1: thread exiting with uncaught exception (group=0x40015560)E/AndroidRuntime(285): FATAL E ...
- ERROR SparkUncaughtExceptionHandler: Uncaught exception in thread
ERROR SparkUncaughtExceptionHandler: Uncaught exception in thread Thread[appclient-registration-retr ...
- 在运行Hibernate Hello World程序的时候,抛如下错误: view plain Exception in thread "main" org.hibernate.exception.LockAcquisitionException 解决方法
在运行Hibernate Hello World程序的时候,抛如下错误: Exception in thread "main" org.hibernate.exception.Lo ...
- meteor报错之:MongoDB had an unspecified uncaught exception.
今天测试的时候meteor报了个错 如下: MongoDB had an unspecified uncaught exception. This can be caused by MongoDB b ...
- iOS- Terminating app due to uncaught exception 'NSRangeException'
错误描述: Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM object ...
- windows redis:Uncaught exception 'RedisException' with message 'Redis server went away'
window-exe-redis-2.8.12服务,当你复制好php_igbinary.dll,php_redis.dll时候,你运行redis报错:Fatal error: Uncaught exc ...
- Terminating app due to uncaught exception 'NSUnknownKeyException' this class is not key value coding-compliant for the key
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ViewController > se ...
随机推荐
- 第三次scrum作业
一.第三次冲刺任务 ! 在已有的基础上实现图书馆管理员对图书信息的查询以及对图书借阅情况的查询. 二.用户故事 本次的用户是图书馆的管理员 用户输入对应的管理员的账号和密码 用户选择图书查询,进入图书 ...
- MySQL优化:使用show status查看MySQL服务器状态信息
在网站开发过程中,有些时候我们需要了解MySQL的服务器状态信息,譬如当前MySQL启动后的运行时间,当前MySQL的客户端会话连接数,当前MySQL服务器执行的慢查询数,当前MySQL执行了多少SE ...
- Linux学习---内存分布基础
内核空间 应用程序不允许访问 -----------------------------------------3G 栈空间 局部变量 RW ----------------------------- ...
- CSS3新增特性及知识学习线路
- scrapy的入门使用(二)
1. scrapy实现翻页请求 找到下一页的url地址 构造url地址的请求,传递给引擎 1.1 实现翻页请求 使用方法 在获取到url地址之后,可以通过scrapy.Request(url,call ...
- rest_framework登录组件,权限组件
昨日回顾: -HyperlinkedIdentityField(用来生成url),传三个参数 -实例化序列化类的时候,BookSerializer(ret, many=True, context={' ...
- 第二次scrum
scrum说明 在第一次已有的基础上,进行了具体的实现.完成了具体的界面设计,还有各个栏目,如:发帖,搜索,禁言等. 类图 依次是外观模式图,发帖图,禁言图. 外观模式图 发帖图 禁言图 团队成员 潘 ...
- java解析json数据用到的jar包
百度云连接: https://pan.baidu.com/s/1iuQCc7uBO5XtAsNn6hwCew
- 自定义导航栏 tabBarController 笔记
#import "LeeNavigationController.h" @interface LeeNavigationController () @end @implementa ...
- java笔试之输出
1. public class foo { private static void testMethod(){ System.out.println("testMethod"); ...