{"action":"created","issue":{"url":"https://api.github.com/repos/AriaLyy/Aria/issues/305","repository_url":"https://api.github.com/repos/AriaLyy/Aria","labels_url":"https://api.github.com/repos/AriaLyy/Aria/issues/305/labels{/name}","comments_url":"https://api.github.com/repos/AriaLyy/Aria/issues/305/comments","events_url":"https://api.github.com/repos/AriaLyy/Aria/issues/305/events","html_url":"https://github.com/AriaLyy/Aria/issues/305","id":356383463,"node_id":"MDU6SXNzdWUzNTYzODM0NjM=","number":305,"title":"下载速度太快，导致安装apk失败，提示解析软件包时出现问题","user":{"login":"wuxusheng","id":6949332,"node_id":"MDQ6VXNlcjY5NDkzMzI=","avatar_url":"https://avatars2.githubusercontent.com/u/6949332?v=4","gravatar_id":"","url":"https://api.github.com/users/wuxusheng","html_url":"https://github.com/wuxusheng","followers_url":"https://api.github.com/users/wuxusheng/followers","following_url":"https://api.github.com/users/wuxusheng/following{/other_user}","gists_url":"https://api.github.com/users/wuxusheng/gists{/gist_id}","starred_url":"https://api.github.com/users/wuxusheng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wuxusheng/subscriptions","organizations_url":"https://api.github.com/users/wuxusheng/orgs","repos_url":"https://api.github.com/users/wuxusheng/repos","events_url":"https://api.github.com/users/wuxusheng/events{/privacy}","received_events_url":"https://api.github.com/users/wuxusheng/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":16,"created_at":"2018-09-03T07:13:08Z","updated_at":"2018-09-06T03:03:57Z","closed_at":null,"author_association":"NONE","body":"## 版本号\r\n3.4.16\r\n\r\n## 什么问题\r\n我在作者的simple中的SingleTaskActivity类启动了一个apk下载，速度没有限制，在oncomplete方法里调用了系统安装方法\r\npublic static void installNormal(Context context,String apkPath) {\r\n        Intent intent = new Intent(Intent.ACTION_VIEW);\r\n        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\r\n        intent.setDataAndType(Uri.fromFile(new File(apkPath)),\r\n                \"application/vnd.android.package-archive\");\r\n        context.startActivity(intent);\r\n    }\r\n然后试了几次，频率较高的会出现提示解析软件包时出现问题，是不是下载太快了，导致包还没有合并完成，我自己打的解析错误时日志如下：\r\n09-09 15:04:26.941 23789-23789/com.arialyy.simple E/SingleTaskActivity: ---running---\r\n09-09 15:04:27.941 23789-23789/com.arialyy.simple E/SingleTaskActivity: ---running---\r\n09-09 15:04:28.942 23789-23789/com.arialyy.simple E/SingleTaskActivity: ---running---\r\n09-09 15:04:29.942 23789-23789/com.arialyy.simple E/SingleTaskActivity: ---running---\r\n09-09 15:04:30.105 23789-23789/com.arialyy.simple E/SingleTaskActivity: ---taskComplete---8.44mb\r\n\r\n最终的task.getConvertFileSize()返回的文件大小确实是真实的文件大小\r\n## 如何复现此问题\r\n\r\n\r\n## 手机型号\r\n\r\n\r\n## 控制台日志（越完整越好）\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/AriaLyy/Aria/issues/comments/418948961","html_url":"https://github.com/AriaLyy/Aria/issues/305#issuecomment-418948961","issue_url":"https://api.github.com/repos/AriaLyy/Aria/issues/305","id":418948961,"node_id":"MDEyOklzc3VlQ29tbWVudDQxODk0ODk2MQ==","user":{"login":"wuxusheng","id":6949332,"node_id":"MDQ6VXNlcjY5NDkzMzI=","avatar_url":"https://avatars2.githubusercontent.com/u/6949332?v=4","gravatar_id":"","url":"https://api.github.com/users/wuxusheng","html_url":"https://github.com/wuxusheng","followers_url":"https://api.github.com/users/wuxusheng/followers","following_url":"https://api.github.com/users/wuxusheng/following{/other_user}","gists_url":"https://api.github.com/users/wuxusheng/gists{/gist_id}","starred_url":"https://api.github.com/users/wuxusheng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wuxusheng/subscriptions","organizations_url":"https://api.github.com/users/wuxusheng/orgs","repos_url":"https://api.github.com/users/wuxusheng/repos","events_url":"https://api.github.com/users/wuxusheng/events{/privacy}","received_events_url":"https://api.github.com/users/wuxusheng/received_events","type":"User","site_admin":false},"created_at":"2018-09-06T03:03:57Z","updated_at":"2018-09-06T03:03:57Z","author_association":"NONE","body":"我试过了加2秒延迟都不行，我加了5秒就好了，另外我调试了一下 \r\nif (file.exists()) {\r\n      final File to = new File(file.getAbsolutePath() + System.currentTimeMillis());\r\n      file.renameTo(to);\r\n      to.delete();\r\n    }\r\n我上边说错了renameTo是返回true，但文件确实是修改成功了，然后也删除成功了，但是下载完成后会出现解析错误，然后我把这段代码改成\r\n if (file.exists()) {\r\n      //final File to = new File(file.getAbsolutePath() + System.currentTimeMillis());\r\n      //file.renameTo(to);\r\n        file.delete();\r\n    }\r\n就没那个问题了，结论是最后锁定在file.renameTo(to);这个方法，我怀疑这个方法有坑，你那边一直没出\r\n这个方法可能真的跟系统有关系。"}}
{"actor":{"display_login":"wuxusheng"}}