当我尝试在Android Studio上调试应用程序时,给出了以下日志输出:

APK文件 /Users/MyApplicationName/app/build/outputs/apk/app-debug.apk没有 存在于磁盘上。

我重启了Android Studio,但是我无法解决这个问题。我怎么解决呢? 谢谢你!


当前回答

单击此选项可解决错误:

其他回答

我让它工作:

关闭项目 从Android Studio欢迎窗口(或文件> New),单击导入项目。

我猜这迫使它重新安装APK,现在一切正常。

首先通过编辑配置来删除cleaner,它可能在构建apk后清理构建。

Click on edit from set run/debug then click on gradle list select the clean project item and then click on -(top 2nd from left).

构建APK(s),并确保它工作

如果你尝试了以上所有的答案,它没有工作,尝试禁用“立即运行”功能。在所有尝试之后,这一个帮助了我。

文件->设置->构建,执行,部署->即时运行->取消选中复选框

我的问题是在文件名中包含分钟-它寻找appname_debug_0.9.0.1 1_170214_2216.apk,而生成的文件是appname_debug_0.9.0.1 1_170214_2217.apk,因此输出文件名代码(从其他地方捕获)显然是从构建中的两个不同的点调用的。

applicationVariants.all { variant ->
        variant.outputs.each { output ->
            def project = "appname"
            def SEP = "_"
    //        def flavor = variant.productFlavors[0].name
            def buildType = variant.variantData.variantConfiguration.buildType.name
            def version = variant.versionName
            def date = new Date();
            def formattedDate = date.format('yyMMdd_HHmm')

            def newApkName = project + SEP + /*flavor + */ SEP + buildType + SEP + version + SEP + formattedDate + ".apk"

            output.outputFile = new File(output.outputFile.parent, newApkName)
        }
    }