简体   繁体   English

使用init命令创建React Native项目

[英]Create react native project with init command

I'm trying to create a new project with react-native init NewProject command. 我正在尝试使用react-native init NewProject命令创建一个新项目。 The project was succesfully created but when I try to run project on genymotion android emulator with : react-native run-android I get the following output: 该项目已成功创建,但是当我尝试使用: react-native run-android在genymotion android模拟器上运行项目时,得到以下输出:

>C:\IdeaProjects\proj>react-native run-android

Scanning folders for symlinks in C:\IdeaProjects\proj\node_modules (56ms)
JS server already running.

Building and installing the app on the device (cd android && gradlew.bat installDebug)...

Observed package id 'platform-tools' in inconsistent location 'C:\Android\Sdk\platform-tools' (Expected 'C:\Android\Sdk\platform-tools\platform-tools')     

Observed package id 'platform-tools' in inconsistent location 'C:\Android\Sdk\platform-tools' (Expected 'C:\Android\Sdk\platform-tools\platform-tools')

Observed package id 'platform-tools' in inconsistent location 'C:\Android\Sdk\platform-tools' (Expected 'C:\Android\Sdk\platform-tools\platform-tools')

Checking the license for package Android SDK Build-Tools 23.0.2 in C:\Android\Sdk\platform-tools\licenses

License for package Android SDK Build-Tools 23.0.2 accepted.

Preparing "Install Android SDK Build-Tools 23.0.2".

>Warning: Trying to install into C:\Android\Sdk\platform-tools\build-tools\23.0.2\ but package "Android SDK Platform-Tools" already exists at C:\Android\Sdk\platform-tools\. It must be deleted o
r moved away before installing into a child directory.

Checking the license for package Android SDK Platform 23 in C:\Android\Sdk\platform-tools\licenses

License for package Android SDK Platform 23 accepted.

Preparing "Install Android SDK Platform 23".

>Warning: Trying to install into C:\Android\Sdk\platform-tools\platforms\android-23\ but package "Android SDK Platform-Tools" already exists at C:\Android\Sdk\platform-tools\. It must be deleted
 or moved away before installing into a child directory.


FAILURE: Build failed with an exception.

A problem occurred configuring project ':app'.
> Failed to install the following SDK components:
  [Android SDK Platform 23, Android SDK Build-Tools 23.0.2]
  Please install the missing components using the SDK manager in Android Studio.

I've already succesfully installed: 我已经成功安装了:

  • Android SDK Platform 30 Android SDK平台30
  • Android SDK Build-Tools 23.0.2 Android SDK Build-Tools 23.0.2

Is someone who can take a look please ? 请问有人可以看看吗? I read some topics but without success.. 我读了一些主题但没有成功。

There's very good documentation available here . 有很好的文档可以在这里找到 See the "Building Projects With Native Code" section here. 请参阅此处的“使用本机代码构建项目”部分。

You might need to setup node , watchman , and a bunch of other dependencies like python2 , react-native-cli . 您可能需要设置nodewatchman以及其他一系列依赖项,例如python2react-native-cli There are some other configurations too, depending on whether you're using Mac or Windows. 还有其他一些配置,具体取决于您使用的是Mac还是Windows。

You might wanna take a look at Create-React-Native-App too. 您可能也想看看Create-React-Native-App It's the most recommended way to get started easily. 这是推荐的轻松入门方法。

You can't build new SDK with old build tools. 您不能使用旧的构建工具来构建新的SDK。 The major version of build tools should be not smaller then SDK. 生成工具的主要版本应不小于SDK。 Example of working setup: 工作设置示例:

  • Android SDK Platform 25 Android SDK平台25
  • Android SDK Build-Tools 25.0.3 Android SDK Build-Tools 25.0.3

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法使用“npx react-native init SampleApp”创建反应原生项目 - Not able to create react native project with “npx react-native init SampleApp” 在Windows上初始化新项目时反应本机错误 - React native error on init new project on windows react-native init 与 Expo 用于新的 React Native 项目? - react-native init versus Expo for new React Native project? React-Native和Expo:create-react-native-app和react-native init之间的任何区别 - React-Native and Expo: Any different between create-react-native-app and react-native init 世博会回应本地初始化 - Expo to react native init 创建一个新项目React Native无法正常工作 - Create a New Project React Native not working 在 Init 项目之后的 React Native 项目中出现错误“无法在 null 对象上获取属性‘依赖项’” - Error “Cannot get property 'dependencies' on null object” in React Native Project just after Init project 有什么方法可以在项目名称中创建一个带有 -(破折号)的 React Native 项目吗? - Is there any way to create a react native project with - (dash) in project name? React Native Android - init失败 - React Native Android - init fails React Native 无法识别“启动”命令(无法启动项目) - React Native not recognizing 'start' command (can't start the project)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM