Android Studio Gradle

Mac下gradle默認不是配置在全局下的,即不可在任意目錄下進行gradle命令,bash

如:gradle -vapp

可是咱們爲了方便,一般會將其配置在全局應用。gradle

步驟以下:spa

  1. 打開.bash_profile,命令行輸入:
    open .bash_profile
  2. 添加gradle的path,訪達中找到Android Studio,右鍵,顯示包內容,找到bin文件夾

    複製bin路徑,注意Android Studio之間有空格,須要轉移「\」,在bash_profile中添加,跟隨其餘PATH後面,export path是以:分割的。
    :/Applications/Android\ Studio.app/Contents/gradle/gradle-5.1.1/bin
    命令行

  3. 使更改生效,命令行輸入:
    source .bash_profile
  4. 若提示沒有權限:Permission denied,則給予超級管理員權限:
    chmod +x /Applications/Android\ Studio.app/Contents/gradle/gradle-5.1.1/bin/gradle
  5. 驗證是否配置成功:
    gradle -v

    大功告成!!!3d

相關文章
相關標籤/搜索