您的位置:首页 > 移动开发 > Android开发

解决Android Studio编译后安装apk报错:The APK file does not exist on disk

2017-04-26 17:11 423 查看


1、错误描述

今天用Android Studio编译应用后安装APK的时候,报错了,错误如下所示:
<code class="hljs applescript has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">The APK <span class="hljs-type" style="box-sizing: border-box;">file</span> build\outputs\apk\OYP_2<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">.3</span><span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">.4</span>_I2Base_6476_official_debug.apk <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">does</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">not</span> exist <span class="hljs-function_start" style="box-sizing: border-box;"><span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">on</span></span> disk. Error <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">while</span> Installing APK</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul>


如下图所示 




2、解决方法

1、尝试了Build -> Clean Project再编译,还是无效 

2、尝试重启Android Studio无效

然后我去打开build\outputs\apk\目录,发现里面编译好了APK文件,不过文件名确实: 

OYP_2.3.4_I2Base_6478_official_debug.apk 

如下图所示: 



因此原因就是,Android Studio编译好之后的APK文件是

OYP_2.3.4_I2Base_6478_official_debug.apk

而它要安装APK文件名确实

OYP_2.3.4_I2Base_6476_official_debug.apk 

因此就会报错了。google查了一下错误,在http://stackoverflow.com网站上有一篇关于此错误的解决方法,链接如下所示: 
http://stackoverflow.com/questions/34039834/the-apk-file-does-not-exist-on-disk

解决方法: 

如下图所示:


第一步:点击Android Studio侧边栏的Gradle按钮,如下所示




第二步:刷新下Gradle的配置




第三步:重新编译即可,不会再报错。

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐