uni-app java.io.FileNotFoundException: apps/H5E7A15D0/www/androidPrivacy.json
uni-app java.io.FileNotFoundException: apps/H5E7A15D0/www/androidPrivacy.json
问题描述
java.io.FileNotFoundException: apps/H5E7A15D0/www/androidPrivacy.json
应用内有这个崩溃,导致退出应用后,安卓系统自动重启了应用,应用退出不了。
这个崩溃我猜测是由于修改了apps下的项目目录,改为和id一样,但是我们项目包名还是原先的,所以出现的问题。 有没有小伙伴出现过此类问题,是如何解决的?
2021-12-09 16:48:05.709 25177-25283/cn.com.yusys.smrx W/System.err: java.io.FileNotFoundException: /system/build.prop: open failed: EACCES (Permission denied)
2021-12-09 16:48:05.709 25177-25283/cn.com.yusys.smrx W/System.err: at libcore.io.IoBridge.open(IoBridge.java:496)
2021-12-09 16:48:05.709 25177-25283/cn.com.yusys.smrx W/System.err: at java.io.FileInputStream.<init>(FileInputStream.java:159)
2021-12-09 16:48:05.709 25177-25283/cn.com.yusys.smrx W/System.err: at java.io.FileInputStream.<init>(FileInputStream.java:115)
2021-12-09 16:48:05.709 25177-25283/cn.com.yusys.smrx W/System.err: at java.io.FileReader.<init>(FileReader.java:58)
2021-12-09 16:48:05.709 25177-25283/cn.com.yusys.smrx W/System.err: at com.tencent.bugly.wemarket.crashreport.common.info.b.p(BUGLY:229)
2021-12-09 16:48:05.709 25177-25283/cn.com.yusys.smrx W/System.err: at com.tencent.bugly.wemarket.crashreport.common.info.b.a(BUGLY:288)
2021-12-09 16:48:05.709 25177-25283/cn.com.yusys.smrx W/System.err: at com.tencent.bugly.wemarket.crashreport.common.info.a.r(BUGLY:502)
2021-12-09 16:48:05.709 25177-25283/cn.com.yusys.smrx W/System.err: at com.tencent.bugly.wemarket.proguard.a.a(BUGLY:160)
2021-12-09 16:48:05.709 25177-25283/cn.com.yusys.smrx W/System.err: at com.tencent.bugly.wemarket.crashreport.biz.a.c(BUGLY:271)
2021-12-09 16:48:05.710 25177-25283/cn.com.yusys.smrx W/System.err: at com.tencent.bugly.wemarket.crashreport.biz.a.a(BUGLY:35)
2021-12-09 16:48:05.710 25177-25283/cn.com.yusys.smrx W/System.err: at com.tencent.bugly.wemarket.crashreport.biz.a$2.run(BUGLY:335)
2021-12-09 16:48:05.710 25177-25283/cn.com.yusys.smrx W/System.err: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
2021-12-09 16:48:05.710 25177-25283/cn.com.yusys.smrx W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:266)
2021-12-09 16:48:05.710 25177-25283/cn.com.yusys.smrx W/System.err: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Schedul
更多关于uni-app java.io.FileNotFoundException: apps/H5E7A15D0/www/androidPrivacy.json的实战教程也可以访问 https://www.itying.com/category-93-b0.html
java.io.FileNotFoundException: apps/H5E7A15D0/www/androidPrivacy.json这个有捕获 所以不会导致崩溃
应用没有崩溃,就是我这边返回两次退出应用,安卓系统以为是崩溃每次给我自动重启。我如果把这个目录改为原先的就没有这个问题。我们现在相当于是包名还是用的原先旧的,appid用的是在开发者中心新生成的。
然后我看logcat日志,就是我上面回复那些报错日志。
我们应用是5+app离线打包
回复 仲夏夜之梦: 看崩溃日志 光说情况无法确定原因
回复 DCloud_Android_ST: 2021-12-09 16:48:05.709 25177-25283/cn.com.yusys.smrx W/System.err: java.io.FileNotFoundException: /system/build.prop: open failed: EACCES (Permission denied) 2021-12-09 16:48:05.709 25177-25283/cn.com.yusys.smrx W/System.err: at libcore.io.IoBridge.open(IoBridge.java:496) 2021-12-09 16:48:05.709 25177-25283/cn.com.yusys.smrx W/System.err: at java.io.FileInputStream.(FileInputStream.java:159) 2021-12-09 16:48:05.709 25177-25283/cn.com.yusys.smrx W/System.err: at java.io.FileInputStream.(FileInputStream.java:115) 2021-12-09 16:48:05.709 25177-25283/cn.com.yusys.smrx W/System.err: at java.io.FileReader.(FileReader.java:58) 2021-12-09 16:48:05.709 25177-25283/cn.com.yusys.smrx W/System.err: at com.tencent.bugly.wemarket.crashreport.common.info.b.p(BUGLY:229) 2021-12-09 16:48:05.709 25177-25283/cn.com.yusys.smrx W/System.err: at com.tencent.bugly.wemarket.crashreport.common.info.b.a(BUGLY:288) 2021-12-09 16:48:05.709 25177-25283/cn.com.yusys.smrx W/System.err: at com.tencent.bugly.wemarket.crashreport.common.info.a.r(BUGLY:502) 2021-12-09 16:48:05.709 25177-25283/cn.com.yusys.smrx W/System.err: at com.tencent.bugly.wemarket.proguard.a.a(BUGLY:160) 2021-12-09 16:48:05.709 25177-25283/cn.com.yusys.smrx W/System.err: at com.tencent.bugly.wemarket.crashreport.biz.a.c(BUGLY:271) 2021-12-09 16:48:05.710 25177-25283/cn.com.yusys.smrx W/System.err: at com.tencent.bugly.wemarket.crashreport.biz.a.a(BUGLY:35) 2021-12-09 16:48:05.710 25177-25283/cn.com.yusys.smrx W/System.err: at com.tencent.bugly.wemarket.crashreport.biz.a$2.run(BUGLY:335) 2021-12-09 16:48:05.710 25177-25283/cn.com.yusys.smrx W/System.err: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462) 2021-12-09 16:48:05.710 25177-25283/cn.com.yusys.smrx W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:266) 2021-12-09 16:48:05.710 25177-25283/cn.com.yusys.smrx W/System.err: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Schedul
这个错误通常是由于隐私政策配置文件路径问题导致的。在uni-app中,安卓平台需要配置隐私政策文件,系统会在特定路径下查找 androidPrivacy.json 文件。
问题分析
- 路径不匹配:错误提示中的
apps/H5E7A15D0/是HBuilderX生成的应用ID,但你的项目包名可能不同 - 文件缺失:系统在预期路径下找不到隐私政策配置文件
解决方案
方案一:检查并创建正确的隐私政策文件
- 在项目根目录创建
nativeplugins文件夹(如果不存在) - 在
nativeplugins中创建androidPrivacy.json文件 - 文件内容参考:
{
"version": "1",
"prompt": "template",
"title": "服务协议和隐私政策",
"message": "请你务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款..."
}
方案二:检查manifest.json配置
确保 manifest.json 中的安卓配置正确:
{
"app-plus": {
"android": {
"privacyConfig": true
}
}
}

