[英]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: 我已经成功安装了:
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
. 您可能需要设置node
, watchman
以及其他一系列依赖项,例如python2
, react-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: 工作设置示例:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.