android gradle 本地路径不存在
android gradle Local path doesn't exist
当我每次 运行 我的应用程序时,Manifest 文件中的 versionName 都会递增。
20389表示是旧版本名,20390是递增的数字。
项目构建成功,如构建成功。但问题是为什么 Android studio 会缓存以前的 apk 版本。这是什么错误:
Target device: lge-nexus_5-061642fd00511249
Uploading file
local path: H:\customFolder\app\build\outputs\apk\MyAppName-0.6.200_20383-debug.apk
remote path: /data/local/tmp/com.example.app
Local path doesn't exist.
当您在设备上安装应用 运行s 时注意,android studio 尝试安装 20383 版本的 apk。这是错误的。谁能帮帮我?我用谷歌搜索并看到了这个 link.
以下是我如何使用 gradle 脚本更改清单文件:
def updateRevisionNumber () {//autoIncrement Version Name
def currentVersion = getVersionName();
def currentRevisionInManifest = currentVersion.substring(currentVersion.indexOf("_")+1);
def lastRevision = Integer.parseInt(currentRevisionInManifest) + 1;
println("currentRevisionInManifest: " + currentRevisionInManifest);
println("lastRevision: " + lastRevision);
def oldText = manifestFile.getText();
def changedText = oldText.replace(currentRevisionInManifest,lastRevision+"");
manifestFile.setText(changedText);}
您可以在清单的 android 部分覆盖版本名称,而不是在构建期间编辑您的清单文件:
android {
...
defaultConfig {
versionName someScriptToComputeVersionName()
...
至少有 2 个这样做的充分理由:
- 构建过程不会更改您的源代码(即 AndroidManifest.xml 不会被修改 - 至少 editable 源代码中的 AndroidManifest.xml '不予修改)
- 很有可能 Android Studio 会很高兴。
现在你的问题是正确定义函数 someScriptToComputeVersionName()
,这取决于你。
IMO,简单地增加一个数字可能不是最好的选择,如果您根据 VCS 修订号构建版本名称,您可能应该寻求解决方案。
当我每次 运行 我的应用程序时,Manifest 文件中的 versionName 都会递增。 20389表示是旧版本名,20390是递增的数字。
项目构建成功,如构建成功。但问题是为什么 Android studio 会缓存以前的 apk 版本。这是什么错误:
Target device: lge-nexus_5-061642fd00511249 Uploading file local path: H:\customFolder\app\build\outputs\apk\MyAppName-0.6.200_20383-debug.apk remote path: /data/local/tmp/com.example.app Local path doesn't exist.
当您在设备上安装应用 运行s 时注意,android studio 尝试安装 20383 版本的 apk。这是错误的。谁能帮帮我?我用谷歌搜索并看到了这个 link.
以下是我如何使用 gradle 脚本更改清单文件:
def updateRevisionNumber () {//autoIncrement Version Name
def currentVersion = getVersionName();
def currentRevisionInManifest = currentVersion.substring(currentVersion.indexOf("_")+1);
def lastRevision = Integer.parseInt(currentRevisionInManifest) + 1;
println("currentRevisionInManifest: " + currentRevisionInManifest);
println("lastRevision: " + lastRevision);
def oldText = manifestFile.getText();
def changedText = oldText.replace(currentRevisionInManifest,lastRevision+"");
manifestFile.setText(changedText);}
您可以在清单的 android 部分覆盖版本名称,而不是在构建期间编辑您的清单文件:
android {
...
defaultConfig {
versionName someScriptToComputeVersionName()
...
至少有 2 个这样做的充分理由:
- 构建过程不会更改您的源代码(即 AndroidManifest.xml 不会被修改 - 至少 editable 源代码中的 AndroidManifest.xml '不予修改)
- 很有可能 Android Studio 会很高兴。
现在你的问题是正确定义函数 someScriptToComputeVersionName()
,这取决于你。
IMO,简单地增加一个数字可能不是最好的选择,如果您根据 VCS 修订号构建版本名称,您可能应该寻求解决方案。