09-18 16:57:23.045: W/System.err(2414): java.io.FileNotFoundException: /storage/emulated/0/download/V2.2.0: open failed: EACCES (Permission denied)
09-18 16:57:23.046: W/System.err(2414): at libcore.io.IoBridge.open(IoBridge.java:487)
09-18 16:57:23.046: W/System.err(2414): at java.io.FileOutputStream.<init>(FileOutputStream.java:87)
09-18 16:57:23.046: W/System.err(2414): at java.io.FileOutputStream.<init>(FileOutputStream.java:72)
09-18 16:57:23.046: W/System.err(2414): at com.xuecheng.dust.update2.UpdateManager$downloadApkThread.run(UpdateManager.java:347)
09-18 16:57:23.046: W/System.err(2414): Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
09-18 16:57:23.046: W/System.err(2414): at libcore.io.Posix.open(Native Method)
09-18 16:57:23.046: W/System.err(2414): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
09-18 16:57:23.046: W/System.err(2414): at libcore.io.IoBridge.open(IoBridge.java:473)
看到这肯定可以断定是没有加权限,随手把读和写的权限加上了:
<!--在SD卡中创建与删除文件权限 -->
<uses-permission android:name="android.permission.MOUNT_FORMAT_FILESYSTEMS" />
<!--向SD卡写入数据的权限 -->
<uses-permission android:name="androd.permission.WRITE_EXTERNAL_STORAGE" />
<!-- 读取数据的权限 -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
编译的时候还是出现同样的问题;经过查询资料发现:
SDK1.5需要android.permission.GET_TASKS权限判断本程序是否为当前运行的应用?
所以又把TASKS权限添加上,就可以运行写的升级程序了
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
共同学习,写下你的评论
评论加载中...
作者其他优质文章