mac 下的 bash gradle command not found

mac 下的 bash gradle command not found

        想查看一下现在项目的依赖关系,网上查了一下需要一个命令(gradle dependencies)但是在使用的时候报错,查了一下网上记录一下;

        1,首先找到自己AS的位置,我的是在:/Users/carrot/Downloads/软件安装包/Android\ Studio\ 3.3\ Preview.app/Contents/gradle/gradle-4.8/bin,需要注意的是,整个路径里面如果有空格的话,需要用“\”进行转译,不然会报错的;

        2,环境变量的配置

            打开terminal终端命令窗口

            1、使用命令[cd ~]到home目录下      cd ~

            2、接着使用     touch .bash_profile   

            3、然后   open -e .bash_profile   会以文本的形式打开文件(如果2中不存在的话就新建一个.bash_profile文件)

                

                    export GRADLE_HOME=/Users/carrot/Downloads/软件安装包/Android\ Studio\ 3.3\ Preview.app/Contents/gradle/gradle-4.8/bin

                    export PATH=${PATH}:${GRADLE_HOME}/bin

            4、最后用[source .bash_profile]命令使用修改后的(这一步的时候可能会报错权限不够,无法应用,可以使用命令:chmod a+x gradle,这一句的意思是把gradle的权限开到最大)

            5、操作完成后使用命令[gradle -v]看是否出现版本号    gradle -v

猜你喜欢

转载自blog.csdn.net/smile_raccoon/article/details/81093606
今日推荐