当我尝试在Android Studio上调试应用程序时,给出了以下日志输出:
APK文件 /Users/MyApplicationName/app/build/outputs/apk/app-debug.apk没有 存在于磁盘上。
我重启了Android Studio,但是我无法解决这个问题。我怎么解决呢? 谢谢你!
当我尝试在Android Studio上调试应用程序时,给出了以下日志输出:
APK文件 /Users/MyApplicationName/app/build/outputs/apk/app-debug.apk没有 存在于磁盘上。
我重启了Android Studio,但是我无法解决这个问题。我怎么解决呢? 谢谢你!
当前回答
首先通过编辑配置来删除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).
其他回答
如果你使用的是Linux,试着给app/build文件夹设置写权限。
以上都没有帮助我,但我通过在构建工具面板中切换到另一种风格,然后切换回所需的风格来解决这个问题。
我的问题是在文件名中包含分钟-它寻找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)
}
}
当我切换git分支时,我经常看到类似的问题。对我来说,关闭AndroidStudio rm -rfv ~/Library/Caches/AndroidStudio*并重新启动AndroidStudio是门票。
2018年5月用新的Android Studio 3.1解决。删除你的app文件夹中的。gradle, .idea和build目录。然后尝试再次运行它,您将不会看到错误。