当我在Android Studio上尝试调试应用程序时,会提供此日志输出:
磁盘上不存在APK文件/Users/MyApplicationName/app/build/outputs/apk/app-debug.apk.
我重新启动了Android Studio,但我无法解决这个问题.我该如何解决?谢谢
我在使用gradle和Android Studio时出现问题,只有在Android Studio中构建时才会出现(BuildServer和Commandline工作正常)
applicationVariants.all { variant ->
def file = variant.outputFile
variant.outputFile = new File(file.parent, file.name.replace("app-", getDate() + "_myapp_" + getGitCommit() +"_"));
}
def getDate() {
def dateNow = new Date()
def formattedDate = dateNow.format('yyyy-MM-dd_HH-mm-ss')
return formattedDate
}
Run Code Online (Sandbox Code Playgroud)
构建工作,但当AS想要将apk复制到设备时,它会抛出Local path doesn't exist.错误.
问题是生成的文件如下所示:
2014-03-17_16-17-41_myapp__debug-unaligned.apk
Run Code Online (Sandbox Code Playgroud)
但AS寻找:
2014-03-17_16-17-18_myapp__debug-unaligned.apk
Run Code Online (Sandbox Code Playgroud)
这是由AS特定的构建步骤以某种方式生成的,导致重新计算日期.我尝试用构建日期的外部属性修复它,在整个构建过程中应保持相同,但可能由于我缺乏gradle技能,这没有帮助.
也许某人有一个解决方法让我在Android Studio中使我的构建工作.
这是一个使用gradle的Android应用程序.点击后Run,我找到了,但事件日志说:APP_V1.3.4_2016-02-22_11:30:29_google_play.apkoutputs/apk
11:30:31 EmptyThrowable:APK文件/.../WorkSpace/Android/.../app/build/outputs/apk/APP_V1.3.4_2016-02-22_ 11:30:14 _google_play.apk不存在在磁盘上.
11:30:32会话'app':安装APK时出错
这是我的build.gradle档案:
apply plugin: 'com.android.application'
def releaseTime() {
return new Date().format("yyyy-MM-dd_HH:mm:ss",
TimeZone.getTimeZone("GMT+08:00"))
}
android {
compileSdkVersion 'Google Inc.:Google APIs:23'
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example"
minSdkVersion 14
targetSdkVersion 23
versionCode 29
versionName "1.3.4"
manifestPlaceholders = [SOME_CHANNEL_VALUE: "some_channel"]
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
signingConfigs {
debug {}
release {
// ...
}
}
buildTypes {
debug {
zipAlignEnabled true
minifyEnabled false
shrinkResources true
}
release {
zipAlignEnabled true
minifyEnabled true …Run Code Online (Sandbox Code Playgroud)