Android.mk 中覆盖应用包名
项目场景:
一般来讲应用包名都是配置在 AndroidManifest.xml 中的,但遇到特殊情况,需要修改源码中应用包名
通常都会先去改 AndroidManifest.xml package 但改为后编译发现一顿错误,原因是 java 类中已经指定了 R 文件包名,
几百个都去替换那岂不是一堆文件需要 add,所以想找找有没有快捷方法,还真被我找到了。
解决方案:
通过配置 LOCAL_AAPT_FLAGS := rename-manifest-package "com.android.camera" 就可以
毕竟在 AS 中通过 gradle 配置 applicationId 就可以修改包名,想来 mk 中也是有的,不常用而已。
一开始发现 mk 中可以修改应用的版本号,那么猜测是不是也可以修改包名。
LOCAL_AAPT_FLAGS := --version-name "$(version_name_package)"
LOCAL_AAPT_FLAGS := --version-code "$(version_code_package)"
通过以上配置可以修改应用版本号,我就顺手配了个 LOCAL_AAPT_FLAGS := --package “com.android.camera”
编译小试一下,报错提示如下
aapt2 link [options] -o arg --manifest arg files…
Options:
-o arg Output path.
–manifest arg Path to the Android manifest to build.
-I arg Adds an Android APK to link against.
-A arg An assets directory to include in the APK. These are unprocessed.
-R arg Compilation unit to link, usingoverlaysemantics.
The last conflicting resource given takes precedence.
–package-id arg Specify the package ID to use for this app. Must be greater or equal to
0x7f and can’t be used with --static-lib or --shared-lib.
–java arg Directory in which to generate R.java.
–proguard arg Output file for generated Proguard rules.
–proguard-main-dex arg Output file for generated Proguard rules for the main dex.
–proguard-conditional-keep-rules Generate conditional Proguard keep rules.
–proguard-minimal-keep-rules Generate a minimal set of Proguard keep rules.
–no-auto-version Disables automatic style and layout SDK versioning.
–no-version-vectors Disables automatic versioning of vector drawables. Use this only
when building with vector drawable support library.
–no-version-transitions Disables automatic versioning of transition resources. Use this only
when building with transition support library.
–no-resource-deduping Disables automatic deduping of resources with
identical values across compatible configurations.
–no-resource-removal Disables automatic removal of resources without
defaults. Use this only when building runtime resource overlay packages.
–enable-sparse-encoding This decreases APK size at the cost of resource retrieval performance.
-x Legacy flag that specifies to use the package identifier 0x01.
-z Require localization of strings marked ‘suggested’.
-c arg Comma separated list of configurations to include. The default
is all configurations.
–preferred-density arg Selects the closest matching density and strips out all others.
–product arg Comma separated list of product names to keep
–output-to-dir Outputs the APK contents to a directory specified by -o.
–no-xml-namespaces Removes XML namespace prefix and URI information
from AndroidManifest.xml and XML binaries in res/*.
–min-sdk-version arg Default minimum SDK version to use for AndroidManifest.xml.
–target-sdk-version arg Default target SDK version to use for AndroidManifest.xml.
–version-code arg Version code (integer) to inject into the AndroidManifest.xml if none is
present.
–version-code-major arg Version code major (integer) to inject into the AndroidManifest.xml if none is
present.
–version-name arg Version name to inject into the AndroidManifest.xml if none is present.
–revision-code arg Revision code (integer) to inject into the AndroidManifest.xml if none is
present.
–replace-version If --version-code, --version-name, and/or --revision-code are specified, these
values will replace any value already in the manifest. By
default, nothing is changed if the manifest already defines
these attributes.
–compile-sdk-version-code arg Version code (integer) to inject into the AndroidManifest.xml if none is
present.
–compile-sdk-version-name arg Version name to inject into the AndroidManifest.xml if none is present.
–shared-lib Generates a shared Android runtime library.
–static-lib Generate a static Android library.
–proto-format Generates compiled resources in Protobuf format.
Suitable as input to the bundle tool for generating an App Bundle.
–no-static-lib-packages Merge all library resources under the app’s package.
–non-final-ids Generates R.java without the final modifier. This is implied when
–static-lib is specified.
–no-proguard-location-reference Keep proguard rules files from having a reference to the source file
–stable-ids arg File containing a list of name to ID mapping.
–emit-ids arg Emit a file at the given path with a list of name to ID mappings,
suitable for use with --stable-ids.
–private-symbols arg Package name to use when generating R.java for private symbols.
If not specified, public and private symbols will use the application’s
package name.
–custom-package arg Custom Java package under which to generate R.java.
–extra-packages arg Generate the same R.java but with different package names.
–add-javadoc-annotation arg Adds a JavaDoc annotation to all generated Java classes.
–output-text-symbols arg Generates a text file containing the resource symbols of the R class in
the specified folder.
–allow-reserved-package-id Allows the use of a reserved package ID. This should on be used for
packages with a pre-O min-sdk–auto-add-overlay Allows the addition of new resources in overlays without
tags.
–override-styles-instead-of-overlaying Causes styles defined in -R resources to replace previous definitions
instead of merging into them–rename-manifest-package arg Renames the package in AndroidManifest.xml.
–rename-resources-package arg Renames the package in resources table
–rename-instrumentation-target-package arg Changes the name of the target package for instrumentation. Most useful
when used in conjunction with --rename-manifest-package.
–rename-overlay-target-package arg Changes the name of the target package for overlay. Most useful
when used in conjunction with --rename-manifest-package.
-0 arg File suffix not to compress.
–no-compress Do not compress any resources.
–keep-raw-values Preserve raw attribute values in xml files.
–no-compress-regex arg Do not compress extensions matching the regular expression. Remember to
use the ‘$’ symbol for end of line. Uses a case-sensitive ECMAScriptregular expression grammar.
–warn-manifest-validation Treat manifest validation errors as warnings.
–split arg Split resources matching a set of configs out to a Split APK.
Syntax: path/to/output.apk:[,[…]].
On Windows, use a semicolon ‘;’ separator instead.
–exclude-configs arg Excludes values of resources whose configs contain the specified qualifiers.
–debug-mode Inserts android:debuggable=“true” in to the application node of the
manifest, making the application debuggable even on production devices.
–strict-visibility Do not allow overlays with different visibility levels.
–exclude-sources Do not serialize source file information when generating resources in
Protobuf format.
–trace-folder arg Generate systrace json trace fragment to specified folder.
–merge-only Only merge the resources, without verifying resource references. This flag
should only be used together with the --static-lib flag.
-v Enables verbose logging.
-h Displays this help menu
可以看到完整的使用提示 ,在其中就可以找到 --rename-manifest-package arg Renames the package in AndroidManifest.xml.
参考文章
Android应用编译时自动生成版本号
相关文章:
Android.mk 中覆盖应用包名
项目场景: 一般来讲应用包名都是配置在 AndroidManifest.xml 中的,但遇到特殊情况,需要修改源码中应用包名 通常都会先去改 AndroidManifest.xml package 但改为后编译发现一顿错误,原因是 java 类中已经指定了 R 文件包名&…...
如何最有效地使用ChatGPT:提问技巧与策略
前言 在如今信息技术高速发展的时代,像ChatGPT这样的大型自然语言处理模型为我们提供了一个强大的工具,以获取各种信息和答案。然而,要充分利用这一工具,您需要掌握一些提问技巧与策略,以确保获得最准确和有用的回答。…...
【JAVA学习笔记】40 - 抽象类、模版设计模式(抽象类的使用)
项目代码 https://github.com/yinhai1114/Java_Learning_Code/tree/main/IDEA_Chapter10/src/com/yinhai/abstract_ 一、抽象类的引入 很多时候在创建类的时候有一个父类,比如animal类,他的子类会有各种方法,为了复用需要进行方法的重写&…...
如何通过在线培训考试系统进行远程教育
随着互联网技术的不断发展,远程教育正在成为一种新型的学习方式,它使学生能够在任何地点、任何时间通过在线培训考试系统接受教育。 利用在线培训考试系统进行远程教育具有很大的灵活性。学生可以根据自己的时间和需求自由选择课程,无需受制…...
2021-arXiv-The Power of Scale for Parameter-Efficient Prompt Tuning
2021-arXiv-The Power of Scale for Parameter-Efficient Prompt Tuning Paper: https://arxiv.org/abs/2104.08691 Code: https://github.com/google-research/ text-to-text-transfer-transformer/ blob/main/released_checkpoints.md# lm-adapted-t511lm100k 在这项工作中&…...
计算机视觉与深度学习 | 非线性优化理论:图优化、高斯牛顿法和列文伯格-马夸尔特算法
===================================================== github:https://github.com/MichaelBeechan CSDN:https://blog.csdn.net/u011344545 ===================================================== 计算机视觉与深度学习 | SLAM国内外研究现状 计算机视觉与深度学习 | 视…...
一文说尽零售数据分析指标体系
零售的本质业务模式是通过在各种渠道上吸引客户来购买我们的商品来实现盈利,其实就是客户-渠道-商品,也就是我们常说的“人、场、货”,除此之外还有供应链、财务等起到重要的辅助作用。因此如果要构建起系统化的零售数据分析指标体系…...
AT2659一款卫星导航低噪声放大器芯片(LNA)
产品介绍 AT2659 是一款专门针对中国 BDS(北斗卫星导航系统),美国的 GPS,俄罗斯的 GLONASS 和欧盟的 GALILEO 导航系统应用而设计的高增益、低噪声系数射频放大器。 AT2659 具有 23dB 高增益和 0.71dB 的低噪声系数。芯片支持 …...
GoLong的学习之路(二)语法之基本数据类型
书接上回:我在GoLong的学习之路(一)中在常量最后说了iota的作用。今天这里我在介绍一下我学习Go语言中基本数据类型。 文章目录 Go中的基本数据类型整型特殊整型数字字面语法 浮点型复数布尔值字符串字符串转义符多行字符字符串的常用操作&am…...
网关概念及java项目中用使用网关场景
网关(Gateway)是一个在网络系统中起到入口和出口的作用的组件或服务。它位于客户端和服务器之间,负责处理进出网络的流量,实现一些重要的功能,如路由、安全认证、协议转换等。 网关在网络架构中扮演了多种角色&#x…...
网页禁止右键 禁止F12 JavaScript禁止F12 禁止右键菜单 包含 js、Jquery、Vue
网页禁止右键 禁止F12 Jquery禁止F12 禁止右键菜单 包含 Jquery、Vue 网页禁止右键 禁止F12 JavaScript禁止F12 禁止右键菜单 jsJavaScript 中Jquery 中Vue 中 这样设置通常是出于安全性或保护内容的目的,不想让别人看到源代码等信息 网页禁止右键 禁止F12 JavaScr…...
Linux系统编程07
线程 为什么有了进程还需要线程 进程切换的时候会花费很大的代价 (1)上下文切换,CPU寄存器需要切换 (2)虚拟地址和物理地址的映射需要切换 进程间通信麻烦 线程是轻量级的进程 (1)线程是一个正…...
html web前端 登录,短信验证码登录
html web前端 登录,短信验证码登录 1,手机号码格式校验 2,按钮点击60秒倒计时,按钮限制点击 3,验证码/或密码长度校验(被注释,公司发的验证码长度不一致,不一定是6位) 4…...
(免费领源码)php#Thinkphp#MYSQL校园二手交易app 99211-计算机毕业设计项目选题推荐
目 录 摘要 Abstract 1 绪论 1.1 研究背景 1.2国内外研究现状 1.3论文结构与章节安排 2 校园二手物品交易app系统分析 2.1 可行性分析 2.2 系统流程分析 2.2.1 数据流程 3.3.2 业务流程 2.3 系统功能分析 2.3.1 功能性分析 2.3.2 非功能性分析 2.4 系统用例分析…...
用Python做数据分析之数据筛选及分类汇总
1、按条件筛选(与,或,非) 为数据筛选,使用与,或,非三个条件配合大于,小于和等于对数据进行筛选,并进行计数和求和。与 excel 中的筛选功能和 countifs 和 sumifs 功能相似…...
RabbitMQ高级篇 笔记
这是一些高级的内容。 RabbitMQ还是运行在网络上的,倘若遇到了网络故障,mq自己挂了,出异常了,都会造成最终状态不一致的问题。这就是可靠性问题。 可靠性:一个消息发送出去之后,至少被消费1次。 要解决这3个…...
javaEE -9(7000字详解TCP/IP协议)
一: IP 地址 IP地址(Internet Protocol Address)是指互联网协议地址,又译为网际协议地址。 IP地址是IP协议提供的一种统一的地址格式,它为互联网上的每一个网络和每一台主机分配一个逻辑地址,以此来屏蔽物…...
在mybatis的xml中使用枚举来做判断条件
1.枚举类 import com.baomidou.mybatisplus.annotation.IEnum; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; import com.shinkeer.common.utils.StringUtils;import java.util.HashMap; import java.util.Map;…...
scala集合的partition方法使用
在Scala中,partition 方法用于将集合(例如 List、Array ,Set等)中的元素根据给定的条件分成两个部分,并返回一个元组,其中包含两个新的集合,第一个包含满足条件的元素,另一个包含不满…...
18 Transformer 的动态流程
博客配套视频链接: https://space.bilibili.com/383551518?spm_id_from333.1007.0.0 b 站直接看 配套 github 链接:https://github.com/nickchen121/Pre-training-language-model 配套博客链接:https://www.cnblogs.com/nickchen121/p/15105048.html 机…...
iOS 26 携众系统重磅更新,但“苹果智能”仍与国行无缘
美国西海岸的夏天,再次被苹果点燃。一年一度的全球开发者大会 WWDC25 如期而至,这不仅是开发者的盛宴,更是全球数亿苹果用户翘首以盼的科技春晚。今年,苹果依旧为我们带来了全家桶式的系统更新,包括 iOS 26、iPadOS 26…...
Java 语言特性(面试系列1)
一、面向对象编程 1. 封装(Encapsulation) 定义:将数据(属性)和操作数据的方法绑定在一起,通过访问控制符(private、protected、public)隐藏内部实现细节。示例: public …...
DockerHub与私有镜像仓库在容器化中的应用与管理
哈喽,大家好,我是左手python! Docker Hub的应用与管理 Docker Hub的基本概念与使用方法 Docker Hub是Docker官方提供的一个公共镜像仓库,用户可以在其中找到各种操作系统、软件和应用的镜像。开发者可以通过Docker Hub轻松获取所…...
visual studio 2022更改主题为深色
visual studio 2022更改主题为深色 点击visual studio 上方的 工具-> 选项 在选项窗口中,选择 环境 -> 常规 ,将其中的颜色主题改成深色 点击确定,更改完成...
最新SpringBoot+SpringCloud+Nacos微服务框架分享
文章目录 前言一、服务规划二、架构核心1.cloud的pom2.gateway的异常handler3.gateway的filter4、admin的pom5、admin的登录核心 三、code-helper分享总结 前言 最近有个活蛮赶的,根据Excel列的需求预估的工时直接打骨折,不要问我为什么,主要…...
什么是库存周转?如何用进销存系统提高库存周转率?
你可能听说过这样一句话: “利润不是赚出来的,是管出来的。” 尤其是在制造业、批发零售、电商这类“货堆成山”的行业,很多企业看着销售不错,账上却没钱、利润也不见了,一翻库存才发现: 一堆卖不动的旧货…...
Python如何给视频添加音频和字幕
在Python中,给视频添加音频和字幕可以使用电影文件处理库MoviePy和字幕处理库Subtitles。下面将详细介绍如何使用这些库来实现视频的音频和字幕添加,包括必要的代码示例和详细解释。 环境准备 在开始之前,需要安装以下Python库:…...
零基础设计模式——行为型模式 - 责任链模式
第四部分:行为型模式 - 责任链模式 (Chain of Responsibility Pattern) 欢迎来到行为型模式的学习!行为型模式关注对象之间的职责分配、算法封装和对象间的交互。我们将学习的第一个行为型模式是责任链模式。 核心思想:使多个对象都有机会处…...
C++ Visual Studio 2017厂商给的源码没有.sln文件 易兆微芯片下载工具加开机动画下载。
1.先用Visual Studio 2017打开Yichip YC31xx loader.vcxproj,再用Visual Studio 2022打开。再保侟就有.sln文件了。 易兆微芯片下载工具加开机动画下载 ExtraDownloadFile1Info.\logo.bin|0|0|10D2000|0 MFC应用兼容CMD 在BOOL CYichipYC31xxloaderDlg::OnIni…...
Aspose.PDF 限制绕过方案:Java 字节码技术实战分享(仅供学习)
Aspose.PDF 限制绕过方案:Java 字节码技术实战分享(仅供学习) 一、Aspose.PDF 简介二、说明(⚠️仅供学习与研究使用)三、技术流程总览四、准备工作1. 下载 Jar 包2. Maven 项目依赖配置 五、字节码修改实现代码&#…...
