Android apk文件结构 打包编译的流程
不管是 Android 知识的学习 还是其他知识的学习 ,最好还是去 官网 学习。因为现在信息年代,很多博客只是复制粘贴,有可能有哪些地方是错误的,会对我们造成误导,当然并不是说我就不复制粘贴了。当然官网介绍的并不详细,我也参考其他博客,把我们需要知道的一些东西也都放到本博客中了。
关于apk签名,修改apk默认名称可以看我的另一篇博客,Android studio apk签名 必须明白的概念 流程 证书指纹获取 apk默认名称修改 详解,当然修改apk默认名称需要掌握一定的gradle 和 groovy语言的知识,也可以自己学习或可以参考我的相关博客,如下:
Groovy语言学习
Android Studio 中如何运行 groovy 程序
gradle学习参考博客
学习gradle的话,相关的东西还是挺多的,我暂时还没用写相关的博客,大家可以参考我gradle学习参考博客里面提供的地址进行学习,也可以自己找相关资源学习,当然最好还是去官网学习啊。
Gradle、Grovvy、Grovvy JDK文档
好了言归正传,下面 是 Google Android 开发者平台 配置构建 部分内容翻译而来,网上很多 “Android打包编译的流程 ” 相关博客 也复制了官网的内容。
Android官网 配置构建 流程
Configure your build
The Android build system compiles app resources and source code, and
packages them into APKs that you can test, deploy, sign, and distribute.
Android Studio uses Gradle, an advanced build toolkit, to automate and
manage the build process, while allowing you to define flexible custom
build configurations. Each build configuration can define its own set of
code and resources, while reusing the parts common to all versions of
your app. The Android plugin for Gradle works with the build toolkit to
provide processes and configurable settings that are specific to
building and testing Android applications.
Android构建系统编译应用程序资源和源代码,并将它们打包成apk,您可以对其进行测试、部署、签名和分发。Android Studio使用高级构建工具包Gradle来自动化和管理构建过程,同时允许您定义灵活的自定义构建配置。每个构建配置都可以定义自己的代码和资源集,同时重用应用程序所有版本的通用部分。用于Gradle的Android插件与构建工具包一起工作,提供特定于构建和测试Android应用程序的流程和可配置设置。
Gradle and the Android plugin run independent of Android Studio. This
means that you can build your Android apps from within Android Studio,
the command line on your machine, or on machines where Android Studio is
not installed (such as continuous integration servers). If you are not
using Android Studio, you can learn how to build and run your app from
the command line. The output of the build is the same whether you are
building a project from the command line, on a remote machine, or using
Android Studio.
Gradle和Android插件独立于Android Studio运行。这意味着您可以在Android Studio、您机器上的命令行或未安装 android studio 的机器(如持续集成服务器)上构建您的Android应用程序。如果您没有使用Android Studio,可以从命令行学习如何构建和运行应用程序。无论您是从命令行、在远程计算机上还是使用Android Studio生成项目,生成的输出都是相同的。