如何在同一设备上同时使用 Debug 和 Release apk? [英] How to have both Debug and Release apk on same device?

查看:33
本文介绍了如何在同一设备上同时使用 Debug 和 Release apk?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在继续开发我的应用程序并在真实手机上测试的同时,为了演示目的,我需要在同一部手机上安装它的发布版本(发布版本响应速度更快,感谢没有日志).

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.

推荐答案

您可能想尝试使用 这种技术="http://en.wikipedia.org/wiki/Apache_Ant" rel="nofollow noreferrer">ant, Jenkins 或许还有其他工具可以按照@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.

尽管不是您所要求的,这个很酷的代码片段可以帮助您在运行时确定您的代码是调试还是发布.

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.

这篇关于如何在同一设备上同时使用 Debug 和 Release apk?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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