如何对同一设备调试和发布APK?设备、APK

2023-09-06 02:55:48 作者:低吟轻唱

在继续发展我的应用程序的和测试它真正的手机,我需要有它的发行版在同一部手机,为了演示(发行版本更为敏感,由于无日志)。

While continuing to develop my application and test it on a real phone, I need to have the release version of it on the same phone, for demonstration purposes (the release version is much more responsive, thanks to no-logs).

现在的问题是,为了使两个应用程序在Android中在同一设备上共存的唯一途径是由具有不同的包名。

The problem is that the only way to make two applications co-exist on the same device in Android is by having different package names.

不过,包名需要重新理和大量的人工繁殖修复......更何况,这混淆了版本控制...

But package names require re-factoring and lots of propagating manual fixes... not to mention that this confuses version control...

理想的情况是,Eclipse + ADT将允许追加修改变量,会自动生成调试/发布不同的包名,而允许这种共存,但我找不到任何允许这样做的机制。

Ideally, Eclipse+ADT would allow appending a modifier variable that would automatically generate a different package name for debug/release and would allow such co-existence, but I couldn't find any mechanism that allows doing that.

你知道有什么方法可以解决这个?

Do you know of any way to workaround this?

创新的解决方案和想法,欢迎。

Creative solutions and ideas are welcome.

推荐答案

您可以尝试这种技术使用的蚂蚁,的詹金斯甚至其他工具来自动包重命名所建议的@LAS_VEGAS。

You may want to try this technique using ant, Jenkins and perhaps other tools to automate package renames as suggested by @LAS_VEGAS.

虽然不是你问的是什么,这个很酷的code段可以帮你找到了在运行时无论您code是调试或发布。

Although not what you asked for, this cool code snippet can help you find out at runtime whether your code is debug or release.

另一个有趣的这样的尝试可以在找到这个线程。我不知道但如果它工作在Android上。

Another interesting such attempt can be found in this thread. I am not sure though if it works on Android.