簡體   English   中英

在 React Native 中配置項目時出現問題

[英]A problem occurred configuring project in React Native

我是 React Native 開發的新手。 我正在嘗試使用react-native run-android在模擬器中運行一個項目。 我得到低於錯誤。

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 應用程序或使用genymotion模擬器

  1. 打開您的 android studio 應用程序並從工具菜單中選擇 SDK 管理器選項。
  2. 選擇 Android API 28,然后單擊應用按鈕從谷歌服務器安裝 android API 28。 安裝完成后,您需要單擊“確定”按鈕。
  3. 現在您可以使用以下命令運行 react native 項目:react-native run-android。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM