Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 在React Native中配置项目时出现问题_Android_React Native - Fatal编程技术网

Android 在React Native中配置项目时出现问题

Android 在React Native中配置项目时出现问题,android,react-native,Android,React Native,我是新来的。我正在尝试使用react native run android在emulator中运行一个项目。我正在犯错误 foysal@laptop:~/Videos/addbook$ react-native run-android Starting JS server... Building and installing the app on the device (cd android && ./gradlew installDebug)... > Configur

我是新来的。我正在尝试使用
react native run android
在emulator中运行一个项目。我正在犯错误

foysal@laptop:~/Videos/addbook$ react-native run-android
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...

> Configure project :app
Observed package id 'tools' in inconsistent location '/home/foysal/Android/Sdk/tools' (Expected '/home/foysal/Android/Sdk/tools/tools')
Checking the license for package Android SDK Build-Tools 27.0.3 in /home/foysal/Android/Sdk/tools/licenses
Warning: License for package Android SDK Build-Tools 27.0.3 not accepted.
Checking the license for package Android SDK Platform 27 in /home/foysal/Android/Sdk/tools/licenses
Warning: License for package Android SDK Platform 27 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.
     platforms;android-27 Android SDK Platform 27
     build-tools;27.0.3 Android SDK Build-Tools 27.0.3
  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/foysal/Android/Sdk/tools

* 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
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
使用“npm serve”代替“react native run android”并在手机中安装expo应用程序,或使用emulator

使用“npm serve”代替“react native run android”并在手机或使用emulator中安装expo应用程序

  • 打开android studio应用程序并从工具菜单中选择SDK管理器选项
  • 选择Android API 28,然后单击应用按钮从google服务器安装Android API 28。完成安装后,需要单击“确定”按钮
  • 现在,您可以使用以下命令运行react native项目:react native run android
  • 打开android studio应用程序并从工具菜单中选择SDK管理器选项
  • 选择Android API 28,然后单击应用按钮从google服务器安装Android API 28。完成安装后,需要单击“确定”按钮
  • 现在,您可以使用以下命令运行react native项目:react native run android

  • @奥尼克,我怎么能这么做?@奥尼克,是的。我已经安装了Android Studio。然后运行SDK管理器并安装缺少的SDK或接受条款。@Onik,我该怎么做?@Onik,是的。我已经安装了Android Studio。然后运行SDK管理器并安装缺少的SDK或接受条款。