uni-app android9崩溃空指针异常,已经第二个android9bug了

uni-app android9崩溃空指针异常,已经第二个android9bug了 产品分类: uniapp/App

属性
PC开发环境操作系统 Windows
PC开发环境操作系统版本号 10
HBuilderX类型 Alpha
HBuilderX版本号 3.3.8
手机系统 Android
手机系统版本号 Android 9.0
手机厂商 Pixel
手机机型 Pixel 3 XL
页面类型 vue
vue版本 vue2
打包方式 云端
项目创建方式 HBuilderX

示例代码

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.bdingmovie/io.dcloud.feature.nativeObj.photoview.PhotoActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.util.ArrayList.size()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2951)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3086)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6718)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.util.ArrayList.size()' on a null object reference
at io.dcloud.feature.nativeObj.photoview.PhotoActivity.onCreate(SourceFile:14)
at android.app.Activity.performCreate(Activity.java:7144)
at android.app.Activity.performCreate(Activity.java:7135)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2931)
... 11 more

更多关于uni-app android9崩溃空指针异常,已经第二个android9bug了的实战教程也可以访问 https://www.itying.com/category-93-b0.html

5 回复

崩溃代码我们这边已处理。不过还需要你这边过一下自己的逻辑。如果预览的图片个数为空不要触发uni.previewImage 否则就算代码处理了逻辑上依然会出现问题

更多关于uni-app android9崩溃空指针异常,已经第二个android9bug了的实战教程也可以访问 https://www.itying.com/category-93-b0.html


我没用过previewImage的api

回复 c***@163.com: 哪里功能有类似于图片预览的功能界面吗。目前报错的位置就是图片预览,预览的图片可放大缩小等功能

回复 DCloud_Android_ST: 全局搜了下用了uni-file-picker组件,里面有个previewImage

回复 c***@163.com: 下个版本捕获异常不会出现崩溃

回到顶部