Mac 出现zsh: command not found: aapt

Mac 运行aapt命令 提示:zsh: command not found: aapt  这个问题是Mac本地没有配置 aapt的 环境变量。理论上本地有Android Studio,aapt是默认配置了的,无奈要用到aapt,还是配置下吧。

mac zsh 配置 aapt 环境变量的方法:

1.在终端输入 open ~/.zshrc 打开zsh环境变量保存的文件。也可以手动去打开

2.进入到Android Studio目录,找到自己 Mac 中 aapt 工具的存放目录:例如我的为:/Users/jason/Library/Android/sdk/build-tools/31.0.0

3.在 .zshrc 文件中添加环境变量配置。

AAPT_HOME=/Users/jason/Library/Android/sdk/build-tools/31.0.0
export AAPT_HOME
export PATH=${PATH}:$AAPT_HOME

4. 然后保存设置:

source ~/.zshrc

5.测试aapt 是否work:

aapt --help

 test result:

jason@zhanghailongdeMacBook-Pro 31.0.0 % aapt --help                                                                                                                      
ERROR: Unknown command '--help'
Android Asset Packaging ToolUsage:aapt l[ist] [-v] [-a] file.{zip,jar,apk}List contents of Zip-compatible archive.aapt d[ump] [--values] [--include-meta-data] WHAT file.{apk} [asset [asset ...]]strings          Print the contents of the resource table string pool in the APK.badging          Print the label and icon for the app declared in APK.permissions      Print the permissions from the APK.resources        Print the resource table from the APK.configurations   Print the configurations in the APK.xmltree          Print the compiled xmls in the given assets.xmlstrings       Print the strings of the given compiled xml assets.aapt p[ackage] [-d][-f][-m][-u][-v][-x][-z][-M AndroidManifest.xml] \[-0 extension [-0 extension ...]] [-g tolerance] [-j jarfile] \[--debug-mode] [--min-sdk-version VAL] [--target-sdk-version VAL] \[--app-version VAL] [--app-version-name TEXT] [--custom-package VAL] \[--rename-manifest-package PACKAGE] \[--rename-instrumentation-target-package PACKAGE] \[--utf16] [--auto-add-overlay] \[--max-res-version VAL] \[-I base-package [-I base-package ...]] \[-A asset-source-dir]  [-G class-list-file] [-P public-definitions-file] \[-D main-dex-class-list-file] \[-S resource-sources [-S resource-sources ...]] \[-F apk-file] [-J R-file-dir] \[--product product1,product2,...] \[-c CONFIGS] [--preferred-density DENSITY] \[--split CONFIGS [--split CONFIGS]] \[--feature-of package [--feature-after package]] \[raw-files-dir [raw-files-dir] ...] \[--output-text-symbols DIR]Package the android resources.  It will read assets and resources that aresupplied with the -M -A -S or raw-files-dir arguments.  The -J -P -F and -Roptions control which files are output.aapt r[emove] [-v] file.{zip,jar,apk} file1 [file2 ...]Delete specified files from Zip-compatible archive.aapt a[dd] [-v] file.{zip,jar,apk} file1 [file2 ...]Add specified files to Zip-compatible archive.aapt c[runch] [-v] -S resource-sources ... -C output-folder ...Do PNG preprocessing on one or several resource foldersand store the results in the output folder.aapt s[ingleCrunch] [-v] -i input-file -o outputfileDo PNG preprocessing on a single file.aapt v[ersion]Print program version.Modifiers:-a  print Android-specific data (resources, manifest) when listing-c  specify which configurations to include.  The default is allconfigurations.  The value of the parameter should be a commaseparated list of configuration values.  Locales should be specifiedas either a language or language-region pair.  Some examples:enport,enport,land,en_US-d  one or more device assets to include, separated by commas-f  force overwrite of existing files-g  specify a pixel tolerance to force images to grayscale, default 0-j  specify a jar or zip file containing classes to include-k  junk path of file(s) added-m  make package directories under location specified by -J-u  update existing packages (add new, replace older, remove deleted files)-v  verbose output-x  create extending (non-application) resource IDs-z  require localization of resource attributes marked withlocalization="suggested"-A  additional directory in which to find raw asset files-G  A file to output proguard options into.-D  A file to output proguard options for the main dex into.-F  specify the apk file to output-I  add an existing package to base include set-J  specify where to output R.java resource constant definitions-M  specify full path to AndroidManifest.xml to include in zip-P  specify where to output public resource definitions-S  directory in which to find resources.  Multiple directories will be scannedand the first match found (left to right) will take precedence.-0  specifies an additional extension for which such files will notbe stored compressed in the .apk.  An empty string means to notcompress any files at all.--debug-modeinserts android:debuggable="true" in to the application node of themanifest, making the application debuggable even on production devices.--include-meta-datawhen used with "dump badging" also includes meta-data tags.--pseudo-localizegenerate resources for pseudo-locales (en-XA and ar-XB).--min-sdk-versioninserts android:minSdkVersion in to manifest.  If the version is 7 orhigher, the default encoding for resources will be in UTF-8.--target-sdk-versioninserts android:targetSdkVersion in to manifest.--max-res-versionignores versioned resource directories above the given value.--valueswhen used with "dump resources" also includes resource values.--version-codeinserts android:versionCode in to manifest.--version-nameinserts android:versionName in to manifest.--replace-versionIf --version-code and/or --version-name are specified, thesevalues will replace any value already in the manifest. Bydefault, nothing is changed if the manifest already definesthese attributes.--custom-packagegenerates R.java into a different package.--extra-packagesgenerate R.java for libraries. Separate libraries with ':'.--generate-dependenciesgenerate dependency files in the same directories for R.java and resource package--auto-add-overlayAutomatically add resources that are only in overlays.--preferred-densitySpecifies a preference for a particular density. Resources that do notmatch this density and have variants that are a closer match are removed.--splitBuilds a separate split APK for the configurations listed. This canbe loaded alongside the base APK at runtime.--feature-ofBuilds a split APK that is a feature of the apk specified here. Resourcesin the base APK can be referenced from the the feature APK.--feature-afterAn app can have multiple Feature Split APKs which must be totally ordered.If --feature-of is specified, this flag specifies which Feature Split APKcomes before this one. The first Feature Split APK should not defineanything here.--rename-manifest-packageRewrite the manifest so that its package name is the package namegiven here.  Relative class names (for example .Foo) will bechanged to absolute names with the old package so that the codedoes not need to change.--rename-instrumentation-target-packageRewrite the manifest so that all of its instrumentationcomponents target the given package.  Useful when used inconjunction with --rename-manifest-package to fix tests againsta package that has been renamed.--productSpecifies which variant to choose for strings that haveproduct variants--utf16changes default encoding for resources to UTF-16.  Only useful when APIlevel is set to 7 or higher where the default encoding is UTF-8.--non-constant-idMake the resources ID non constant. This is required to make an R java classthat does not contain the final value but is used to make reusable compiledlibraries that need to access resources.--shared-libMake a shared library resource package that can be loaded by an applicationat runtime to access the libraries resources. Implies --non-constant-id.--app-as-shared-libMake an app resource package that also can be loaded as shared library at runtime.Implies --non-constant-id.--error-on-failed-insertForces aapt to return an error if it fails to insert values into the manifestwith --debug-mode, --min-sdk-version, --target-sdk-version --version-codeand --version-name.Insertion typically fails if the manifest already defines the attribute.--error-on-missing-config-entryForces aapt to return an error if it fails to find an entry for a configuration.--output-text-symbolsGenerates a text file containing the resource symbols of the R class in thespecified folder.--ignore-assetsAssets to be ignored. Default pattern is:!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~--skip-symbols-without-default-localizationPrevents symbols from being generated for strings that do not have a defaultlocalization--no-version-vectorsDo not automatically generate versioned copies of vector XML resources.--no-version-transitionsDo not automatically generate versioned copies of transition XML resources.--private-symbolsJava package name to use when generating R.java for private resources.
jason@zhanghailongdeMacBook-Pro 31.0.0 % 

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/883577.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

前端对一个增删改查的思考

1、来源&#xff1a;dify dify/web/app/components/workflow/nodes/question-classifier/components/class-list.tsx at main langgenius/dify GitHub 2、代码流程&#xff1a; 3、思索问题&#xff1a; 1、为啥要用return形式&#xff0c;而不是value直接当函数&#xff1…

SQL进阶技巧:如何求组内排除当前行的移动平均值?

目录 0 需求描述 2 数据准备 3 问题分析 4 小结 0 需求描述 -- 按照 日期,省份,等级 分组 求分数的平均值;但是需要剔除当前行的数据 2 数据准备 create table avgtest as (select 2024-10-24 as cdate, 广东 as province,深圳 as city, 2 as level, 200 as scoreunio…

ssm005基于SSM框架的购物商城系统的开发与实现(论文+源码)_kaic

设计题目&#xff1a;购物商城系统的设计与实现 摘 要 网络技术和计算机技术发展至今&#xff0c;已经拥有了深厚的理论基础&#xff0c;并在现实中进行了充分运用&#xff0c;尤其是基于计算机运行的软件更是受到各界的关注。加上现在人们已经步入信息时代&#xff0c;所以对…

【MyBatis】| JavaWeb基础教程学习笔记(上)

01-MyBatis简介 什么是MyBatis? MyBatis是一款优秀的持久层框架&#xff0c;用于简化JDBC开发MyBatis本是Apache的一个开源项目iBatis&#xff0c;2010年这个项目由apache software foundation迁移到了google code&#xff0c;并且改名为MyBatis。2013年11月迁移到Github官网…

双11必买物品清单有哪些?双11推荐购买清单推荐分享

随着一年一度的“双十一”购物狂欢节的到来&#xff0c;各大电商平台纷纷推出了各种优惠活动和促销策略&#xff0c;让消费者在享受购物乐趣的同时也能获得实实在在的优惠。然而&#xff0c;面对琳琅满目的商品和纷繁复杂的促销活动&#xff0c;双11必买物品清单有哪些成为了一…

【AIGC】从CoT到BoT:AGI推理能力提升24%的技术变革如何驱动ChatGPT未来发展

博客主页&#xff1a; [小ᶻZ࿆] 本文专栏: AIGC | ChatGPT 文章目录 &#x1f4af;前言&#x1f4af;迈向AGI的新跨越&#x1f4af;BoT与CoT的技术对比技术原理差异推理性能提升应用范围和通用性从错误中学习的能力总结 &#x1f4af;BoT的工作流程和机制初始化过程生成推…

网上摄影工作室:Spring Boot框架的应用实例

2相关技术 2.1 MYSQL数据库 MySQL是一个真正的多用户、多线程SQL数据库服务器。 是基于SQL的客户/服务器模式的关系数据库管理系统&#xff0c;它的有点有有功能强大、使用简单、管理方便、安全可靠性高、运行速度快、多线程、跨平台性、完全网络化、稳定性等&#xff0c;非常…

Redis——缓存

目录 前言 一、缓存基本概念 1.概念 2.二八定律 二、使用 Redis 作为缓存 三、缓存的更新策略 1.定期生成 2.实时生成 四、Redis 内存淘汰机制 1.通用淘汰策略 &#xff08;1&#xff09;FIFO &#xff08;2&#xff09;LRU &#xff08;3&#xff09;LFU &#…

buildroot制作自己的软件包(可以理解为应用程序)

以helloworld为例记录使用步骤 一&#xff1a;书写自己的源程序以及Makefile helloworld.c #include <stdio.h>int main(int argc, char **argv) {printf("hello world\r\n");return 0; }Makefile all: helloworldhelloworld: helloworld.o$(CC) -o hellow…

模型训练识别手写数字(二)

模型训练识别手写数字&#xff08;一&#xff09;使用手写数字图像进行模型测试 一、生成手写数字图像 1. 导入所需库 import cv2 import numpy as np import oscv2用于计算机视觉操作。 numpy用于处理数组和图像数据。 os用于文件和目录操作。 2. 初始化画布 canvas np.z…

Kaggle竞赛——灾难推文分类(Disaster Tweets)

目录 1. 准备工作2. 资源导入3. 数据处理4. 绘制词云图5. 数据可视化5.1 词数和字符数可视化5.2 元特征可视化5.3 类别可视化 6. 词元分析6.1 一元语法统计6.2 多元语法统计 7. 命名实体识别8. 推文主题提取9. 构建模型9.1 数据划分与封装9.2 模型训练与验证 10. 模型评估11. 测…

SQL:Windows下MySQL的安装教程(超详细)

一.系统环境&#xff1a; 操作系统&#xff1a; Windows11&#xff1b; MySQL版本&#xff1a; mysql-community-8.0.40.0&#xff1b; 二.MySQL下载&#xff1a; 访问MySQL 官网下载地址&#xff1a;https://www.mysql.com/&#xff0c;点击DOWNLOADS&#xff1b; 跳转后页…

Maven---依赖管理,项目构建工具

1.Maven安装和配置 1.1设置本地仓库 提前准备好仓库的位置,打开配置文件maven/conf/setting.xml 1.2配置阿里镜像源 在mirrors节点(标签)下添加阿里中央仓库镜像,把原本的镜像源注释掉,不要写在mirrors标签外 <mirror><id>alimaven</id><name>aliy…

6 款超实用的 Coze 插件,让你的智能体开发效率提升 200%

最近我一直在频繁使用 Coze 智能体&#xff0c;帮朋友和客户实现各种定制化需求。 Coze 不仅提供了强大的工作流编排能力和全面的功能节点&#xff0c;还有大量由开发者和平台上传的插件库支持。 对于智能体开发者来说&#xff0c;找到一款合适、好用的插件&#xff0c;真的能…

【实用知识】Spring Boot 优雅捕捉异常的几种姿势

&#x1f449;博主介绍&#xff1a; 博主从事应用安全和大数据领域&#xff0c;有8年研发经验&#xff0c;5年面试官经验&#xff0c;Java技术专家&#xff0c;WEB架构师&#xff0c;阿里云专家博主&#xff0c;华为云云享专家&#xff0c;51CTO 专家博主 ⛪️ 个人社区&#x…

JVM(HotSpot):GC之G1垃圾回收器

文章目录 一、简介二、工作原理三、Young Collection 跨代引用四、大对象问题 一、简介 1、适用场景 同时注重吞吐量&#xff08;Throughput&#xff09;和低延迟&#xff08;Low latency&#xff09;&#xff0c;默认的暂停目标是 200 ms超大堆内存&#xff0c;会将堆划分为…

华为云弹性云服务器无法登录远程操作

遇到的问题&#xff1a; 就是你在创建弹性云服务器的时候选择了没有子网的虚拟私有云&#xff0c; 你属于误删了虚拟私有云的子网&#xff0c;自己没有注意看 如果在华为云创建弹性云服务器时选择的虚拟私有云&#xff08;VPC&#xff09;没有配置子网&#xff0c;那么在尝试远…

【mysql 进阶】2-1. MySQL 服务器介绍

MySQL 服务器简介 通常所说的 MySQL 服务器指的是mysqld程序&#xff0c;当运⾏mysqld后对外提供MySQL 服务&#xff0c;这个专题的内容涵盖了以下关于MySQL 服务器以及相关配置的内容&#xff0c;包括&#xff1a; 服务器⽀持的启动选项。可以在命令⾏和配置⽂件中指定这些选…

嵌入式C语言字符串具体实现

大家好,今天主要给大家分享一下,如何使用C语言进行字符串操作与实现。 第一:字符串相关操作实现 复制函数五个基本要素: 头文件:#include <string.h> 函数原型:strcpy(char dest[],char src[]) -----string copy 功能:把src数组中\0之前的所有字符,连同‘\…

在xml 中 不等式 做转义处理的问题

对于这种要做转义处理&#xff0c;<![CDATA[ < ]]>