The APK file D:\.....\debug\app-PjbAndroidTest-debug.apk does not exist on disk.
Error while Installing APK
解决办法
在项目根目录添加如下代码
def isDebug() {
def taskNames = gradle.startParameter.taskNames
for (tn in taskNames) {
if( (tn.contains("install") || tn.contains("assemble")) && tn.contains("Debug")) {
return true
}
}
return false
}
然后如果是AS3.2版本的,同时自定义了apk输出目录的需要添加如下代码,判断语句中的代码可自行修改,看懂意思即可
if (!isDebug()) {
variant.getPackageApplication().outputDirectory = new File(project.rootDir.absolutePath + File.separator + "appOutputs")
}