Mac + android
參考步驟: 環(huán)境搭建
由于之前已經(jīng)安裝過AS,所以AS上并沒有按照教程走完所以步驟。記錄下踩的坑:
Error message:
1. sdk路徑不存在
What went wrong:
A problem occurred configuring project ':app'.
The SDK directory '/Users/mika_1990/Applications/sdk' does not exist.
原因: 路徑不識別诡曙,Android SDK Build-Tools 23.0.1
沒安裝成功
按 解決方案 導(dǎo)入AS補全缺失的tool
2. 沒有自動連上模擬器
What went wrong:
Execution failed for task ':app:installDebug'.
com.android.builder.testing.api.DeviceException: No connected devices!
原因: 真機可以自動連上,模擬器需要事先打開坐梯。
3. adb路徑?jīng)]成功
Error message:
-bash: adb: command not found
原因:路徑?jīng)]設(shè)置正確
解決方案:在命令行輸入路徑驗證是否正確,如
/Applications/sdk/platform-tools/adb
如果沒有提示錯誤則驗證成功刹帕。就可以把該路徑寫入.bash_profile文件
4. 配置$ANDROID_HOME變量
進入用戶目錄
$ cd ~
如果不存在.bash_profile文件吵血,則創(chuàng)建該文件
$touch .bash_profile
用文本編輯器TextEdit打開.bash_profile文件。如果你是第一次配置環(huán)境變量偷溺,則該文檔應(yīng)該是空的蹋辅。
$open -e .bash_profile
貼入打開的bash_profile文本
export ANDROID_HOME=~/Library/Android/sdk
然后使用下列命令使其立即生效(否則重啟后才生效):
source ~/.bash_profile
可以使用echo $ANDROID_HOME
檢查此變量是否已正確設(shè)置。