1. 程式人生 > >react native生成APP報錯:You have not accepted the license agreements of the following SDK components:

react native生成APP報錯:You have not accepted the license agreements of the following SDK components:

今晚因為這個問題,加班到晚上11點都沒搞出來。實在是氣憤,幸好回來查詢資料,終於找到了罪魁禍首。

一、報錯資訊

* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApk'.
   > A problem occurred configuring project ':jcore-react-native'.
      > You have not accepted the license agreements of the following SDK components:
[Android SDK Build-Tools 23.0.2].
Before building your project, you need to accept the license agreements and complete the installation of the mi
ponents using the Android Studio SDK Manager.
Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.
om/r/studio-ui/export-licenses.html

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
就是這串程式碼。總是說我的license有問題。說我沒有接受SDK的一些協議之類的。反正當時百思不得其解。

二、錯誤原因

從Android Gradle plugin 2.2.0開始,gradle會自動載入需要的SDK, build-tools,但是因為沒有接受license,導致載入依賴終止。

三、解決辦法

(1)找到自己的android SDK位置,進入Tools/bin目錄下

(2)開啟cmd,進入上面的目錄

(3)輸入下面命令

 sdkmanager.bat --licenses
(4)輸入之後,會跳出來很多東西,我們只需要全部寫上y即可

(5)成功提示


四、經過以上步驟之後,大家就可以繼續按照自己的需求來操作了。

參考連結:http://blog.csdn.net/xlyrh/article/details/54667633

http://blog.csdn.net/y505772146/article/details/75807622

end