NullPointerException:null result when primitive expected
来源:互联网 发布:centos 7服务器dvd安装 编辑:程序博客网 时间:2024/06/01 09:27
完整异常日志如下:
E/AndroidRuntime( 962): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.audiopolicytest/com.example.audiopolicytest.MainActivity}: java.lang.NullPointerException: null result when primitive expectedE/AndroidRuntime( 962): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)E/AndroidRuntime( 962): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)E/AndroidRuntime( 962): at android.app.ActivityThread.access$800(ActivityThread.java:135)E/AndroidRuntime( 962): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)E/AndroidRuntime( 962): at android.os.Handler.dispatchMessage(Handler.java:102)E/AndroidRuntime( 962): at android.os.Looper.loop(Looper.java:136)E/AndroidRuntime( 962): at android.app.ActivityThread.main(ActivityThread.java:5001)E/AndroidRuntime( 962): at java.lang.reflect.Method.invokeNative(Native Method)E/AndroidRuntime( 962): at java.lang.reflect.Method.invoke(Method.java:515)E/AndroidRuntime( 962): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)E/AndroidRuntime( 962): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)E/AndroidRuntime( 962): at com.alta.android.chiron.Chiron.main(Chiron.java:137)E/AndroidRuntime( 962): at dalvik.system.NativeStart.main(Native Method)E/AndroidRuntime( 962): Caused by: java.lang.NullPointerException: null result when primitive expectedE/AndroidRuntime( 962): at android.media.AudioManager.requestAudioFocus(Native Method)E/AndroidRuntime( 962): at com.example.audiopolicytest.MainActivity.onCreate(MainActivity.java:25)E/AndroidRuntime( 962): at android.app.Activity.performCreate(Activity.java:5231)E/AndroidRuntime( 962): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)E/AndroidRuntime( 962): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
【问题原因】:该异常翻译过来就是:返回结果为null与实际期望的返回类型不一致。此处导致该错误的原因是由于跨进程同步通信时,远程进程无法连接导致该错误。
【解决方法】:方法一是保证同步通信正常返回;方法二是改同步通信为异步通信,使调用迅速返回。
1 0
- NullPointerException:null result when primitive expected
- Expected one result (or null) to be returned by selectOne()
- java.lang.NullPointerException: Expected timestamp in the Flume event headers, but it was null
- java.lang.NullPointerException: Expected timestamp in the Flume event headers, but it was null
- java.lang.NullPointerException: Expected timestamp in the Flume event headers, but it was null
- java.lang.NullPointerException: Expected timestamp in the Flume event headers, but it was null
- Mybatis 中Expected one result (or null) to be returned by selectOne(), but found: 4
- Mybatis 中Expected one result (or null) to be returned by selectOne(), but found: 5
- mybatis报错:Expected one result (or null) to be returned by selectOne(), but found: 20
- Caused by: org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be
- org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned b
- Expected one result (or null) to be returned by selectOne(), but found: 2问题完美解决
- org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned b
- Expected one result (or null) to be returned by selectOne(), but found: 2
- Expected one result (or null) to be returned by selectOne(), but found
- Expected one result (or null) to be returned by selectOne(), but found: 2
- Expected one result (or null) to be returned by selectOne(), but found: 2
- 遇到Expected one result (or null) to be returned by selectOne(), but found: 2怎么解决
- cudnn 加速
- 网络流24题之T9 方格取数问题
- java enum(枚举)使用详情
- 取数 dp
- css3:border-image边框图像详解
- NullPointerException:null result when primitive expected
- Injectable、Promise、Interface、使用服务
- 欢迎使用CSDN-markdown编辑器
- node.js之基本流处理模块stream
- Structural directives、再谈组件生命周期
- Qt/QML开发支持下载的简单浏览器
- OpenCV中findContours轮廓提取一个边缘只对应的一个轮廓
- mysql limit用法
- 获取时间戳