從Android Gradle plugin 2.2.0開始,gradle會自動加載需要的SDK, build-tools谢鹊,但是因為沒有接受license瞳遍,導(dǎo)致加載依賴終止,提示
* What went wrong:
A problem occurred configuring project ':app'.
> You have not accepted the license agreements of the following SDK components:
[Android SDK Build-Tools 24.0.2].
Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html
有什么辦法自動接受所有的license呢双谆?
問題解決
license存放在$ANDROID_HOME/licenses下
創(chuàng)建license
Linux
mkdir "$ANDROID_HOME/licenses"
echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
Windows
mkdir "%ANDROID_HOME%\licenses"
echo |set /p="8933bad161af4178b1185d1a37fbf41ea5269c55" > "%ANDROID_HOME%\licenses\android-sdk-license"