调用uni.downloadFile下载文件之后用uni.openDocument 打开临时目录
- 发布:2021-09-03 10:51
- 更新:2021-09-03 15:56
- 阅读:907
产品分类: uniapp/App
PC开发环境操作系统: Mac
PC开发环境操作系统版本号: Big Sur 11.5
HBuilderX类型: 正式
HBuilderX版本号: 3.2.3
手机系统: Android
手机系统版本号: Android 8.0
手机厂商: 华为
手机机型: P9
页面类型: vue
打包方式: 离线
项目创建方式: HBuilderX
操作步骤:
预期结果:
正常打开预览
正常打开预览
实际结果:
报错
报错
bug描述:
下载文件后调用 uni.openDocument 报错,异常如下:
W/System.err: org.json.JSONException: Value null of type org.json.JSONObject$1 cannot be converted to JSONObject
W/System.err: at org.json.JSON.typeMismatch(JSON.java:111)
at org.json.JSONObject.<init>(JSONObject.java:163)
at org.json.JSONObject.<init>(JSONObject.java:176)
at io.dcloud.feature.pdr.RuntimeFeatureImpl.execute(SourceFile:420)
at io.dcloud.common.adapter.util.MessageHandler$1.handleMessage(SourceFile:3)
at android.os.Handler.dispatchMessage(Handler.java:108)
at android.os.Looper.loop(Looper.java:166)
W/System.err: at android.app.ActivityThread.main(ActivityThread.java:7529)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.XmlResourceParser android.content.pm.ProviderInfo.loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference
W/System.err: at android.support.v4.content.FileProvider.parsePathStrategy(FileProvider.java:605)
at android.support.v4.content.FileProvider.getPathStrategy(FileProvider.java:579)
at android.support.v4.content.FileProvider.getUriForFile(FileProvider.java:417)
at io.dcloud.common.util.LoadAppUtils.getDataAndTypeIntent(SourceFile:6)
at io.dcloud.common.adapter.util.PlatformUtil.openFileBySystem(SourceFile:17)
W/System.err: at io.dcloud.feature.pdr.RuntimeFeatureImpl.execute(SourceFile:427)
at io.dcloud.common.adapter.util.MessageHandler$1.handleMessage(SourceFile:3)
at android.os.Handler.dispatchMessage(Handler.java:108)
at android.os.Looper.loop(Looper.java:166)
at android.app.ActivityThread.main(ActivityThread.java:7529)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
4***@qq.com (作者)
解决了,没有替换${apk.applicationId}为自己的应用id
2021-09-03 16:40