我正试图开始运行我的react native项目.但我在运行react-native run-android命令时出现了这个错误.我在网上找到了很多解决方案,但都没用.


info Starting JS server...
info Installing the app...

> Configure project :app
Checking the license for package Android SDK Build-Tools 28.0.3 in /home/dipanshuchaubey/Android/Sdk/licenses
Warning: License for package Android SDK Build-Tools 28.0.3 not accepted.
Checking the license for package Android SDK Platform 28 in /home/dipanshuchaubey/Android/Sdk/licenses
Warning: License for package Android SDK Platform 28 not accepted.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
     build-tools;28.0.3 Android SDK Build-Tools 28.0.3
     platforms;android-28 Android SDK Platform 28
  To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
  Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html

  Using Android SDK: /home/dipanshuchaubey/Android/Sdk

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

3s内构建失败

error Failed to install the app. Please accept all necessary SDK licenses using SDK Manager: "$ANDROID_HOME/tools/bin/sdkmanager --licenses". Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
     build-tools;28.0.3 Android SDK Build-Tools 28.0.3
     platforms;android-28 Android SDK Platform 28
  To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
  Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html

  Using Android SDK: /home/dipanshuchaubey/Android/Sdk

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

3s内构建失败

at checkExecSyncError (child_process.js:616:11)
at execFileSync (child_process.js:634:15)
at runOnAllDevices (/home/dipanshuchaubey/Documents/practice/native/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:75:39)
at buildAndRun (/home/dipanshuchaubey/Documents/practice/native/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:137:41)
at /home/dipanshuchaubey/Documents/practice/native/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:103:12
at processTicksAndRejections (internal/process/task_queues.js:89:5)
at async Command.handleAction (/home/dipanshuchaubey/Documents/practice/native/node_modules/react-native/node_modules/@react-native-community/cli/build/cliEntry.js:160:7)

如何解决这个问题.

提前感谢:)

推荐答案

Go to Configure>SDK Manager in your Android Studio.

Select SDK Tools选项卡并安装Google Play Licensing Library

React-native相关问答推荐

复制__自持props

防止 React Native 在上下文值更改时重新安装组件

根据搜索字符串中的每个字母过滤数组

React Native - 何时调用componentWillUnmount?

如何判断 Detox 正在运行测试?

RNMK - 超级表达式必须为空或函数

React Native Ios错误 - ENOENT:no such file or directory, uv_cwd (null)

React Native 响应式图像宽度,而图像的宽度/高度比保持不变

React Native React 导航标题按钮事件

如何为我的 React Native Android 应用程序使用 Crashlytics?

如何将抖动动画添加到视图(react-native)?

在 Android React Native 应用程序中正确使用 Intl

大型列表的 React-Native FlatList 性能问题

react-navigation模式高度

如何用 Realm 元素文件组织 React Native?

如何在 React Native 中将图像放置在其他图像之上?

如何在本机代码(Java、ObjectiveC/Swift)中读取 AsyncStorage

zIndex 不适用于react-native元素

将 colored颜色 变量导入我的样式

如何在 React-Native 中停止touch 事件传播