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必买物品清单有哪些成为了一…

面向对象进阶(下)(JAVA笔记第二十五期)

p.s.这是萌新自己自学总结的笔记&#xff0c;如果想学习得更透彻的话还是请去看大佬的讲解 目录 抽象方法和抽象类抽象方法定义格式抽象类定义格式抽象方法和抽象类注意事项 接口接口的定义接口中成员变量的特点接口中没有构造方法接口中成员方法的特点在接口中定义具有方法体…

vue3中ref和reactive的用法,区别和优缺点,以及使用场景

写在前头&#xff1a; reactive定义的数据只能修改里面的属性&#xff0c;不能将整个数据替换&#xff0c;实在要替换请使用 Object.assign(obj1, obj2);举个例子 这种写法无法直接改变obj1 let obj1 reactive({name: 猫,age: 2, });obj1 {name: 猪,age: 2, } 正确的写法…

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

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

LLVM - 编译器前端-llvm:IRBuilder 介绍

一:概述 llvm::IRBuilder 是 LLVM 中的一个重要类,用于方便地构建 LLVM 中间表示(IR)。它提供了一种高层次的接口,使得生成和操作 IR 更加简洁和高效。通过使用 IRBuilder,开发者可以轻松地创建基本块、指令、函数等,而不需要直接操作低级别的 LLVM API。它的主要功能有…

网上摄影工作室: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 &#…

ubantu 编译安装ceph 18.2.4

下载ceph代码 git clone https://github.com/ceph/ceph.git #切换tag git checkout v18.2.4 -b v18.2.4 #下载子模块 会有报错重新执行即可 git submodule update --init --recursive安装ceph所需要的依赖 #curl命令安装 sudo apt install curl#安装ceph依赖 ./install-deps.…

SQL内外连接详解

SQL中的内连接&#xff08;INNER JOIN&#xff09;和外连接&#xff08;包括左外连接LEFT JOIN/LEFT OUTER JOIN、右外连接RIGHT JOIN/RIGHT OUTER JOIN&#xff09;是用于从两个或多个表中组合数据的技术。这里用一些简单的例子来帮助理解。 内连接&#xff08;INNER JOIN&am…

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…

API接口:驱动日常生活便利与商业决策智慧的关键力量

1. 日常生活中的应用 智能家居 场景描述&#xff1a;智能家居系统通过集成各种设备的API接口&#xff0c;实现远程控制和自动化。例如&#xff0c;通过API接口&#xff0c;用户可以通过手机应用控制家中的灯光、温度、安防系统等。案例&#xff1a;某智能家居品牌通过集成智能…

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

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

【学术会议论文投稿】前端框架巅峰对决:React、Vue与Angular的全面解析与实战指南

【JPCS独立出版】​第三届能源与动力工程国际学术会议&#xff08;EPE 2024&#xff09;_艾思科蓝_学术一站式服务平台 更多学术会议请看&#xff1a;https://ais.cn/u/nuyAF3 引言 在快速发展的前端技术领域&#xff0c;选择合适的框架或库对于项目的成功至关重要。React、Vu…

什么是Java策略模式?与Spring的完美结合

文章目录 什么是策略模式&#xff1f;策略模式的组成部分&#xff1a; 策略模式的示例在Spring中的妙用1. 使用Spring配置2. 在上下文中选择策略3. 动态切换策略 总结推荐阅读文章 在软件设计中&#xff0c;策略模式是一种非常常见的设计模式&#xff0c;它能够让算法的变化独立…

CesiumJS 案例 P7:添加指定长宽的图片图层(原点分别为图片图层的中心点、左上角顶点、右上角顶点、左下角顶点、右下角顶点)

CesiumJS CesiumJS API&#xff1a;https://cesium.com/learn/cesiumjs/ref-doc/index.html CesiumJS 是一个开源的 JavaScript 库&#xff0c;它用于在网页中创建和控制 3D 地球仪&#xff08;地图&#xff09; 一、添加指定长宽的图片图层&#xff08;原点为图片图层的中心…

Redis的Key和Value的设计原则有哪些?

在设计 Redis 的 Key 和 Value 时&#xff0c;需要考虑一些原则&#xff0c;以确保数据存储和检索的效率&#xff0c;以及满足特定用例的需求。以下是一些设计 Redis Key 和 Value 的原则: Key 的设计原则 1.可读性:一个Key应该具有比较好的可读性&#xff0c;让人能看得懂是…