反应原生 | 无法安装该应用程序。请使用 SDK Manager 接受所有必要的 SDK 许可

Dip*_*bey 36 android android-studio react-native

我试图开始运行我的 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

BUILD FAILED in 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
Run Code Online (Sandbox Code Playgroud)

3 秒内构建失败

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)
Run Code Online (Sandbox Code Playgroud)

如何解决这个问题。

先感谢您 :)

use*_*035 95

转到Android Studio 中的配置>SDK 管理器

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

  • 这是唯一对我有帮助的事情;多谢 (4认同)
  • 出乎意料...只需点击一下,您就能解决问题 (2认同)

Arc*_*rma 15

对于 linux 用户::

  1. 导航到 PATH :: cd ~/Library/Android/sdk/tools/bin/OR PATH of your Android > sdk > tools > bin
  2. 然后运行sdkmanager如下: ./sdkmanager --licenses

并接受您尚未接受(但需要)的许可证。

有关更多详细信息,请参阅Android Studio 文档


小智 6

如果您使用的是 ubuntu,请执行以下操作:--

1>导航到Android工作室:- ~/Library/Android/sdk/tools/bin

2> 运行此命令:- ./sdkmanager --licenses

  • 嘿,运行此命令后,输出为“bash:/tools/bin/sdkmanager:没有这样的文件或目录” (2认同)