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 ...
随机推荐
- 464. Can I Win
https://leetcode.com/problems/can-i-win/description/ In the "100 game," two players take t ...
- C++标准库第二版笔记 3 和异常的理解 1
C++标准库第二版笔记 3 和异常的理解 1 差错和异常(error and exception)的处理 标准异常类(exception class) 定义于 分为: 1.语言本身支持的异常 2.标准 ...
- hql- 使用like的小坑①
like '%_test_' 要把反斜杠进行转义like '%\_test\_'
- Goldwave-5.7[逆向流程+算法分析]
目标程序:Goldwave 5.7 分析工具: 1.OllyDbg 2.IDAPro 目的:用C语言写Goldwave-5.7的注册机. 0x0思路: 1.注册机准备: 功能:输入用户名后经过计算输出 ...
- java 项目相关 学习记录
一位资深程序员大牛给予Java初学者的学习路线建议 [任何时期都可以好好看看] https://www.imooc.com/article/8993 https://www.jianshu.com/ ...
- android-读取MediaProvider
1.MediaProvider存储手机中的媒体文件,用 SQLite 数据库存储图片.视频.音频等多媒体文件的信息,供视频播放器.音乐播放器.图库使用.以 root 权限进入 adb shell,使用 ...
- banner
依赖 compile 'com.youth.banner:banner:+' 主Activity private void bannerLunBo() { MyBanner.setImageLoade ...
- 又见C++
一年了,重新学奥赛,感慨蛮多. 首先就是觉得去年白学了,MinGW操作基本上忘完了,cry: 然后发现做题速度还比不上刚学的,一道题能错三遍,依旧cry; 不过总算弄明白double和int,还找到了 ...
- 包建强的培训课程(10):Android插件化从入门到精通
@import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/c ...
- 学习Axure RP原型设计
1 概述 原型设计是应用开发设计的第一要素.好的原型设计不仅可以起到沟通的作用,而且对客户而言应用程序拥有更直观的体现.原型设计通过内容和结构展示以及界面布局编排,实现在开发前期用户与产品进行交互.提 ...