当我尝试在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文件的一些信息,然后点击“现在同步”,就可以了。
其他回答
我的问题是我将版本号附加到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)
}
}
如果你使用的是Linux,试着给app/build文件夹设置写权限。
首先通过编辑配置来删除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).
assemble[Variant]会在磁盘上为你生成APK,尽管不需要使用它来调试应用程序。
在工程项目根目录下执行如下命令:
$ ./gradlew clean build assemble[Variant]
GL
这些方法我都试过了,但没有一个奏效。我最终不得不在同一时间内做一些这样的事情。花了这么多时间真是令人沮丧。
我遇到的问题与升级到AS 3.1后运行单元测试有关。
以下是我所做的… 1)。运行/编辑配置/选择测试.... 2)。为“Gradle-aware Make”添加选项 3)。选中Misc选项卡上的“如果ADK未更改,则跳过安装”复选框
祝你好运。