android - react native : How to currently accept all license agreements on Android

标签 android reactjs react-native

我正在尝试运行 react-native run-android 并收到此错误消息:

  • 出了什么问题: 配置项目“:RNSwipeView”时出现问题。

    You have not accepted the license agreements of the following SDK components: [Android SDK Platform 23, Android SDK Build-Tools 26.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

我尝试转到提供的链接,该链接将我重定向到提供的更新链接,该链接指示我转到工具 > Android > SDK 管理器。我没有发现在我正在从事的当前项目中: 你可以亲眼看到:

enter image description here

所以我决定打开一个全新的项目,我确实找到了SDK Manager:

enter image description here

哪里有勾选许可协议(protocol)的方框?我找不到一个。

我也试过以下方法:

据推测,我能够以这种方式接受许可:

cd ~/Library/Android/sdk/tools/bin
➜  bin ./sdkmanager --licenses
Warning: File /Users/danale/.android/repositories.cfg could not be loaded.
All SDK package licenses accepted.======] 100% Computing updates...

当我尝试运行 react-native run-android 时,我再次遇到同样的错误。

于是我按照这个答案(Automatically accept all SDK licences)这样试了一下:

✗ yes | sudo ~/Library/Android/sdk/tools/bin/sdkmanager --licenses
Password:
Warning: File /var/root/.android/repositories.cfg could not be loaded.
All SDK package licenses accepted.======] 100% Computing updates...

运行 react-native run-android 并继续得到与上面相同的错误。

我试着按照 Sarats 的回答: License for package Android SDK Platform 23 not accepted

只会遇到这个错误:

The "android" command is deprecated.
For manual SDK, AVD, and project management, please use Android Studio.
For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager
*************************************************************************
"android" SDK commands can be translated to sdkmanager commands on a best-effort basis.
Continue? (This prompt can be suppressed with the --use-sdk-wrapper command-line argument
or by setting the USE_SDK_WRAPPER environment variable) [y/N]: /usr/local/share/android-sdk/tools/android: line 118: ${trysdkresponse,,}: bad substitution
Invalid or unsupported command "update sdk"

Supported commands are:
android list target
android list avd
android list device
android create avd
android move avd
android delete avd
android list sdk
android update sdk

我如何才能接受这些许可协议(protocol)?

最佳答案

您可以从命令行接受许可协议(protocol)。导航到 sdkmanager。 ~/Library/Android/sdk/tools/bin 然后运行 ​​sdkmanager ./sdkmanager --licenses 并接受您需要的许可证。您可以阅读有关 sdkmanager 的更多信息 here

关于android - react native : How to currently accept all license agreements on Android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56135895/

相关文章:

android - 无法运行adb反向: spawnSync React-Native ENOENT

android - 无法在 Windows 10 上运行 Android Studio

python - 如何使用 Python/Django 作为后端进行 ReactJS 应用程序的服务器端渲染?

javascript - 构建运行时挂起 'react-native run-ios'

javascript - AsyncStorage 和抽屉呈现始终为空

android - 在 Android Studio 中将 lint 列表导出为 HTML 不会用 lint 问题替换我的 index.html

Android espresso——如何使用dagger2注入(inject)依赖

javascript - 如何在我的 React Native 应用程序中添加 NativeBase 页脚?

javascript - 将父目录中的文件导入 React Native 应用程序

javascript - 如何让React路由器响应404状态码?