如何通过命令行界面使用另一个软件包名称在发布模式下重建Android应用程序? [英] How to rebuild Android app in release mode with another package name by command line interface?

查看:297
本文介绍了如何通过命令行界面使用另一个软件包名称在发布模式下重建Android应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我建立一个通用的应用程序,可以通过xmls和文件在res上配置。我试图使不同的apps从同一个代码来源。问题是,通过命令行界面来处理这个问题,我仍然没有找到一种方法来更改包名称,然后在发布模式下构建它。



我创建了我的自定义build.xml ant文件,我尝试了此解决方案,它会生成2个apache: MainActivity-debug.apk MainActivity-debug-unaligned.apk 但没有为我工作,因为apk只是建立在调试模式,甚至没有运行模拟器投掷[INSTALL_FAILED_INVALID_APK]。



那么有办法这样做吗?主要问题是关于调试或发布模式,因为我认为我只需要使用 ant发布命令,是关于创建一个具有不同包名称的apk,所以我可以在同一个设备上签名和运行。



谢谢!

解决方案

As commonsWare 建议我使用 Gradle 为此解决方案。




  • 我使用了这个用于安卓的Gradle。

  • 我使用了这个在发布模式下构建应用程序的答案

  • 我也习惯了commonsWare说的话,看过这个



非常感谢!


Hello im making an generic app that is configurable by xmls and files on res. Im trying to make differents apks from the same source of code. The problem is that im triying to do this by command line interface and i still dont find a way to change the package name and then build it in release mode.

I created my custom build.xml ant file and I tryed this solution,it generates 2 apks: MainActivity-debug.apk and MainActivity-debug-unaligned.apk but didnt work for me since the apk just built on debug mode and didnt even ran on emulator throwing [ INSTALL_FAILED_INVALID_APK].

So is there a way of doing this? The main problem isnt about debug or release mode since i think i just will have to use ant release command, is about creating an apk with different packages names so i can have both signed and running in same device.

Thank you!

解决方案

As commonsWare proposed i used Gradle for this solutions.

  • I used this tutorial for Gradle with android.
  • I used this answer for building apps in release mode
  • I used flavors also as commonsWare said, read this

Thanks a lot!

这篇关于如何通过命令行界面使用另一个软件包名称在发布模式下重建Android应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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