【问题标题】:Android repackaging through ant debug and then ant releaseAndroid重新打包通过ant debug然后ant release
【发布时间】:2015-06-11 06:25:57
【问题描述】:

我是 ant 脚本的新手,但想要完成一些我完全陷入困境的任务,也许有人可以帮助我解决它,


目标是什么?

  1. 通过ant编译Android项目
  2. 从命令行从旧到新重新打包 Android 项目。
  3. 然后在新包上,通过命令行编译实现 最终签名 apk。

设置了什么环境?

  1. Mac 使用终端命令行、ant 和 SDK 配置为家庭 A 已使用“android-project-update -p”更新的单个项目 (生成 build.xml 、 local.properties 等)

有待解决的问题。 在 build.xml 上添加了以下目标

<target
name="-package-resources"
depends="-crunch" >

<echo>Repackaging AndroidManifest.xml to ${package.manifest.name} ${out.absolute.dir}/${resource.package.file.name}</echo>

<exec executable="${aapt}" failonerror="true">
    <arg value="package" />
    <arg value="-f" />
    <arg value="--auto-add-overlay" />
    <arg value="-M" />
    <arg path="AndroidManifest.xml" />
    <arg value="-S" />
    <arg path="${resource.absolute.dir}" />
    <arg value="-A" />
    <arg path="${asset.absolute.dir}" />
    <arg value="-I" />
    <arg path="${project.target.android.jar}" />
    <arg value="-F" />
    <arg path="${out.absolute.dir}/${resource.package.file.name}" />
    <arg value="--rename-manifest-package" />
    <arg value="${package.manifest.name}" />
</exec>

从上面在build.xml中添加的脚本运行时

ant debug -Dapp.custompackagename=com.example.testpackageTwo

可以成功重新打包android项目,输出apk是debug.apk但是当在同一个项目上运行ant release时它执行。然后outout singed APK无法从ant release安装到设备上

- 有没有办法在ant脚本中使用条件来在ant debug和ant release之间切换,以绕过上面的add脚本。 - 或任何其他方式获取发布 apk。从 ant debug 重新打包后

【问题讨论】:

    标签: android command-line ant build packaging


    【解决方案1】:

    Android 已经提供了命令

    android update project
    

    和

    ant debug install
    

    和

    ant release install
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-03
      相关资源
      最近更新 更多