The APK file D:\Code\Air\app\build\outputs\apk\.apk does not exist on disk.
2017-12-06 11:15
756 查看
今天在手机上运行调试的项目时候提示
再看具体日志提示:
尝试了,rebuild,clean,restart等等方法未果,后来google,不得不说google的强大,查到一篇这样的文章:
https://stackoverflow.com/questions/39765345/the-apk-file-does-not-exist-on-disk-but-it-does
对比一下,我正好在gradle中封装了打包的日期,如下:
项目gradle中添加了时间:
所以出现这个问题,解决办法在调试的时候先注释掉这部分代码,打包的时候再添加上吧,或者封装的时候就不要把时间添加上了
Session 'app': Error Installing APK
再看具体日志提示:
The APK file D:\Code\Air\app\build\outputs\apk\.apk does not exist on disk.
尝试了,rebuild,clean,restart等等方法未果,后来google,不得不说google的强大,查到一篇这样的文章:
https://stackoverflow.com/questions/39765345/the-apk-file-does-not-exist-on-disk-but-it-does
对比一下,我正好在gradle中封装了打包的日期,如下:
applicationVariants.all { variant -> variant.outputs.each { output -> def outputFile = output.outputFile def fileName if (outputFile != null && outputFile.name.endsWith('.apk')) { // 输出apk名称为XXapp1.4.0_2017-02-14.apk if (variant.buildType.name.equals('release')) { fileName = "air_${defaultConfig.versionCode}_v${defaultConfig.versionName}_${releaseTime()}_${debugTime()}_release.apk" } else if (variant.buildType.name.equals('debug')) { fileName = "air_${defaultConfig.versionCode}_v${defaultConfig.versionName}_${releaseTime()}_${debugTime()}_debug.apk" } output.outputFile = new File(outputFile.parent, fileName) } } }
项目gradle中添加了时间:
def releaseTime() { return new Date().format("yyyy-MM-dd", TimeZone.getTimeZone("GMT+8")) } def debugTime() { return new Date().format("HH-mm", TimeZone.getTimeZone("GMT+8")) }
所以出现这个问题,解决办法在调试的时候先注释掉这部分代码,打包的时候再添加上吧,或者封装的时候就不要把时间添加上了
相关文章推荐
- Android 错误(The APK file *.apk does not exist on disk Error while Installing APK)解决方法
- The APK file does not exist on disk
- The APK file does not exist on disk.Error while Installing APK
- Debug 切换 Release 编译i The APK file does not exist on disk.Error while Installing APK
- the apk file apk does not exist on disk以及AndroidStudio修改了代码但是跑到机器上却没任何反应解决方案
- The APK file **** does not exist on disk
- The APK file does not exist on disk
- 解决Android Studio编译后安装apk报错:The APK file does not exist on disk
- The APK file does not exist on disk
- 解决Android Studio编译后安装apk报错:The APK file does not exist on disk
- 解决Android Studio编译后安装apk报错:The APK file does not exist on disk
- Android Studio编译后安装apk报错:The APK file does not exist on disk
- EmptyThrowable: The APK file does not exist on disk.
- 解决Android Studio编译后安装apk报错:The APK file does not exist on disk
- The APK file does not exist on disk.Error while Installing APK
- Android Studio The APK file does not exist on disk
- Android Studio 报 The APK file does not exist on disk
- 解决Android Studio编译后安装apk报错:The APK file does not exist on disk
- 我的Android进阶之旅------>解决Android Studio编译后安装apk报错:The APK file does not exist on disk
- 解决Android Studio编译后安装apk报错:The APK file does not exist on disk