当我尝试在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,但是我无法解决这个问题。我怎么解决呢? 谢谢你!
当前回答
我也得到了这个问题后,清理构建。对我来说,解决方案是我只是同步gradle,它为我工作。
其他回答
确保在路径中没有撇号或&
如果你使用的是Linux,试着给app/build文件夹设置写权限。
确保在运行/调试配置>>启动前部分中有分级感知的Make:
1) This problem occure due to apk file .if your apk file
(output/apk/debug.apk) not generated in this format .
2) you should use always in gradle file .
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
我的问题是我将版本号附加到APK。更改版本号和重新同步Gradle为我解决了这个问题。
def appendVersionNameVersionCode(variant, defaultConfig) {
variant.outputs.each { output ->
if (output.zipAlign) {
def file = output.outputFile
def removeApp = file.name.replace("app-", "")
def removeType = removeApp.replace("-release", "")
def fileName = removeType.replace(".apk", "." + defaultConfig.versionName + ".apk")
output.outputFile = new File(file.parent, fileName)
}
def file = output.packageApplication.outputFile
def removeApp = file.name.replace("app-", "")
def removeType = removeApp.replace("-release", "")
def fileName = removeType.replace(".apk", "." + defaultConfig.versionName + ".apk")
output.packageApplication.outputFile = new File(file.parent, fileName)
}
}