Android的工作室上传无菌APK到设备时,摇篮定制逻辑变化的APK名 [英] Android Studio uploads sterile APK to device when Gradle has custom logic changing APK names

查看:142
本文介绍了Android的工作室上传无菌APK到设备时,摇篮定制逻辑变化的APK名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虽然采用了Android工作室我遇到了以下错误:

While using Android Studio I encountered the following error:

在APK的日期比当前的旧2天(摇篮被用于追加构建日期APK名)。我检查的 \编译\输出\ APK 的,以及APK与正确的日期确实已经生成的文件夹:

The date of the APK is 2 days older than the current one (Gradle is used to append the build date to APK name). I've checked folder \build\outputs\apk, and an APK with the correct date has indeed been generated:

在如下曾经尝试过:

  • 构建 - >清理项目
  • 构建 - >重建项目
  • 文件 - >的Invalidate缓存/重新启动......

我怎么解决这个问题,以便能够正确的APK上传到设备运行?

How do I fix this so the correct APK can be uploaded to device to run?

编辑: 改变了标题,以更好地反映哪里会出现此问题的情况。看来,Android的工作室会记得,当它被同步与Android工作室由摇篮提供的APK文件名,但的没有的更新APK名时,摇篮是跑到创建实际的文件。

Changed the title to better reflect the circumstances where this issue would occur. It appears that Android Studio would remember the APK names provided by Gradle when it's been synced with Android Studio, but does not update the APK names when Gradle is ran to create the actual files.

在我的情况它是由一个事实,即当前的日期附加到APK名字造成的,所以如果我同步摇篮到Android工作室12/3 Android的工作室会记得APK文件名是 app_2014-12- 03.apk 的)。然后用摇篮建立和12/4运行的应用程序会导致Android的Studio和Gralde,其中Gralde产生的 app_2014-12- 04 .apk文件的,但Android的工作室相脱节还记得在APK文件名是 app_2014-12- 03 .apk文件的。

In my situation it's caused by the fact that the current date is appended to the APK name, so if I synced Gradle to Android Studio on 12/3 Android Studio would remember the APK filename to be app_2014-12-03.apk). Then using Gradle build and run the app on 12/4 would cause the disconnection between Android Studio and Gralde, where Gralde generated app_2014-12-04.apk and yet Android Studio still remembered the APK filename to be app_2014-12-03.apk.

推荐答案

这是摇篮和Android工作室之间同步的问题。 preSS摇篮同步图标(这是项目结构和AVD管理之间的图标),它会解决这个问题。

It is a problem with sync between Gradle and Android Studio. Press Gradle Sync icon (it is icon between Project Structure and AVD Manager) and it will solve the issue.

(在评论你要求的解释 - 我发现这个答案几个星期前,我还曾发出与本[但现在我找不到这个页面如果我没记错的是信息,即在同步摇篮的通知AS。有关不同信息,包括有关的apk路径信息。在你的情况[和我在过去的路径】每天都在变化,因为我们有日期的apk的名称,因为这一点,我们必须做出同步)

(In comments you asked for explanation - I found this answer few weeks ago, when I had also issue with this[but now I cannot find this page]. If I remember correctly was information, that during Sync Gradle is informing AS about different information including info about apk path. In your case [and mine in past] path is changing every day, as we have date in name of apk and due to this we have to make Sync)

这篇关于Android的工作室上传无菌APK到设备时,摇篮定制逻辑变化的APK名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆