在Mac OSX中,Android Studio执行编译命令报错:bash: gradle: command not found
配置全局环境变量
1,找到gradle路径
在文件夹下找到gradle后打开goshell,可获得gragle的路径
/Applications/Android\ Studio.app/Contents/gradle/gradle-4.1/bin
2,编辑配置文件
ccdemacbook:~ wxd$ vi .bash_profile
在.bash_profile文件中添加export PATH=$PATH:/Applications/Android\ Studio.app/Contents/gradle/gradle-4.1/bin
报错:ccdemacbook:Android wxd$ gradle
bash: /Applications/Android Studio.app/Contents/gradle/gradle-4.1/bin/gradle: Permission denied
解决办法:
cd /Applications/Android Studio.app/Contents/gradle/gradle-4.1/bin/
chmod +x gradle
网友评论