Android应用的打包

为什么Android应用需要打包?

Android系统要求具有其开发者签名的私人密钥的应用程序才能够被安装。因此,打包之后才能发布该应用。

打包的步骤?

1. 选中项目–>”Android Tools”–>”Export Signed Application Package…”

这里写图片描述

2. 点击”next”

这里写图片描述
其中,Location为证书库将要存放的位置,Password是证书库的密码。

3. 选择”Create new keystore”新创建一个证书库,单击”Browse…”按钮选择证书库将要保存的位置并填入信息。

这里写图片描述
什么是keystore?
Keystore是一种数字证书,可以用来识别发布者的身份。数字证书含有两部分数据:一部分是发布者的信息,另一部分是所对应的公钥。Android Market要求每一个app都提供一个证书,这样在应用发布之后,拥有私钥的发布者就可以随时更新版本。

4. 如果已经拥有一个证书,那么可以选择”Use existing keystore”,然后直接选择keystore的位置。

这里写图片描述

什么是Gradle?Gradle和打包有什么关系?

Gradle is a build automation tool that builds upon the concepts of Apache Ant and Apache Maven and introduces a Groovy-based domain-specific language (DSL) instead of the more traditional XML form of declaring the project configuration. Gradle uses a directed acyclic graph (“DAG”) to determine the order in which tasks can be run[1].
Build和complie有什么区别和联系?
Compiling is the act of turning source code into object code.
Linking is the act of combining object code with libraries into a raw executable.
Building is the sequence composed of compiling and linking, with possibly other tasks such as installer creation[2].
Gradle可以实现app的批量打包和多渠道打包。
什么是多渠道打包?
Android市场有众多的渠道(如豌豆荚、应用宝等)。为了统计每个渠道的下载数据,我们需要针对不同渠道打包。可以在AndroidManifest.xml里或用java代码设置渠道。如果手工做这件事,那是相当麻烦的,每个渠道都要改一次代码,单独导出一个apk,但Gradle可以帮我们完成这些工作[3]

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值