mac下使用命令行打包出现bash gradle command not found的解决方案

时间:2022-02-28 10:23:08

命令行打包的时候出现 bash gradle command not found这个问题,主要是因为gradle环境丢失。需要重新配置gradle的环境变量。

1. gradle路径的查找

mac下使用命令行打包出现bash gradle command not found的解决方案

mac下使用命令行打包出现bash gradle command not found的解决方案

mac下使用命令行打包出现bash gradle command not found的解决方案

然后gradle 右键 显示简介 复制下蓝色的

mac下使用命令行打包出现bash gradle command not found的解决方案

2. 环境变量的配置

在.bash_profile文件中,添加如下图选中内容的配置信息:

mac下使用命令行打包出现bash gradle command not found的解决方案

执行source .bash_profile,将配置的环境变量生效。

使用命令[gradle -v]看是否出现版本号,如果出现版本号,说明环境变量配置成功了。