为什么 Android Instant 运行 几乎每次都重新编译?

Why is Android Instant Run recompiling almost every time?

我正在 Android 即时 运行 测试 运行。为了进行测试,我刚刚将以下行添加到 Activity:

的 onResume()
Toast.makeText(this, "test123", Toast.LENGTH_SHORT).show();

现在,当我更改 toast 的文本并重建时,它会告诉我

"Instant Run detected that a resource referenced from the AndroidManifest.xml file has changed"

谁能解释一下这是怎么回事?我没有更改任何资源,只是 Activity java 文件中的字符串文字。 (我知道我应该在 Android btw 中使用字符串资源)。

问题似乎是我的 build.gradle 修改了 Android 清单:

debug {
    ...
    def theVersionNameSuffix = "-debug-" + getCurrentDateTimeString();
    versionNameSuffix theVersionNameSuffix
    ...
}

由于后缀在每个构建中都不同,这意味着版本名称在构建之间发生变化,从而改变 AndroidManifest。

我已经删除了 versionNameSuffix 条目,现在它似乎可以工作了。