今天在项目开发中碰到了这样一个问题:

  项目在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)的问题的更多相关文章

  1. 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 ...

  2. threadid=1: thread exiting with uncaught exception (group=0xb2a86d70)

    这个错误是程序运行成功,但是一在虚拟机上运行就报“停止运行了”,如图: 然后我们查看一个日志信息: 查了好久,终于 搞好了,原因是安卓目标SDK版本太高了,我这里创建好默认是这样的如图: 只要把21改 ...

  3. threadid=1: thread exiting with uncaught.exception ......解决方法

     threadid=1: thread exiting with uncaught exception (group=0x40015560)E/AndroidRuntime(285): FATAL E ...

  4. ERROR SparkUncaughtExceptionHandler: Uncaught exception in thread

    ERROR SparkUncaughtExceptionHandler: Uncaught exception in thread Thread[appclient-registration-retr ...

  5. 在运行Hibernate Hello World程序的时候,抛如下错误: view plain Exception in thread "main" org.hibernate.exception.LockAcquisitionException 解决方法

    在运行Hibernate Hello World程序的时候,抛如下错误: Exception in thread "main" org.hibernate.exception.Lo ...

  6. meteor报错之:MongoDB had an unspecified uncaught exception.

    今天测试的时候meteor报了个错 如下: MongoDB had an unspecified uncaught exception. This can be caused by MongoDB b ...

  7. iOS- Terminating app due to uncaught exception 'NSRangeException'

    错误描述: Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM object ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. nginx上传文件时 nginx 413 Request Entity Too Large 错误

    产生原因: 上传文件的大小超出了 Nginx 允许的最大值,默认是1M: 解决方法: 修改Nginx的配置文件(一般是:nginx/nginx.conf),在 http{} 段中增大nginx上传文件 ...

  2. Mac- appium 环境配置

    一: 下载    appium : https://bitbucket.org/appium/appium.app/downloads/ 下载安装完,打开appium,安全性与隐私设置  检测提示: ...

  3. firebug定位工具很强大

    firebug这个工具很强大,如果实在找不到自己想要的元素,就安装firebug这个定位工具妥妥的

  4. fastjson 序列化,反序列化Map对象的顺序问题

    使用JSONObject  读取JSON字符串时,读取出来的数据,通过变量时是无序的. 但是业务希望返回是顺序的. String str="{name:\"A\",add ...

  5. Object constructor

    1. Object is an instance of Function.2. Object does not have a property called constructor so when w ...

  6. Paper | 学习多任务中的最佳分/ 合结构(十字绣结构)

    目录 1. 问题 2. 十字绣结构(Cross-stitch architecture) 3. 实验设计 论文:Cross-stitch Networks for Multi-task Learnin ...

  7. HTML5标签汇总及知识学习线路总结

    HTML5标签汇总,以及知识学习线路总结.

  8. recyclerview刷新

    https://blog.csdn.net/leejizhou/article/details/51179233 RecyclerView之更新UI数据的高级用法 https://www.cnblog ...

  9. 利用openxml在Excel中插入图表

    using System.Collections.Generic; using System.Linq; using DOD = DocumentFormat.OpenXml.Drawing; usi ...

  10. c# 反射小Demo

    今天看了一下C#的反射,之前一直感觉反射是一种很高大上的东东,现在才发现不过是纸老虎而以. 所谓的反射就是,只是知道一个它是一个对象不知道其中有什么字段方法属性等,而反射就是用来获取一个未知对象的字段 ...