[英]Trying to build react-native to my device
I am trying to build my react native app. 我正在尝试构建我的本机应用程序。 But I keep getting this error enter image description here
但我一直收到此错误,请在此处输入图片描述
What went wrong: A problem occurred configuring project ':app'. 出了什么问题:配置项目':app'时发生问题。
failed to find target with hash string 'android-23' in: C:\\sdk
在以下位置找不到带有哈希字符串“ android-23”的目标:C:\\ sdk
Try: Run with --stacktrace option to get the stack trace. 尝试:使用--stacktrace选项运行以获取堆栈跟踪。 Run with --info or --debug option to get more log output.
使用--info或--debug选项运行以获取更多日志输出。
BUILD FAILED 建立失败
On SDK Manager , be sure to check the box on " show package descriptions" ; 在SDK Manager上 ,请确保选中“ 显示软件包说明”框; then you should also select the " Google APIs " for the version you are willing to install.
那么您还应该为要安装的版本选择“ Google API ”。
Install it and then you should be ok... 安装它,然后就可以了...
hope it'll helps you... 希望对您有帮助...
I usually open Android Studio after I setup my react native app, and open the android project from there (choose open, navigate to the app folder, then choose the android app folder inside of it), 我通常会在设置我的React本机应用程序后打开Android Studio,然后从那里打开android项目(选择打开,导航到app文件夹,然后在其中选择android app文件夹),
then also go to project's build.gradle
file (the one with Top-level build file... text on top) and change the following: 然后还转到项目的
build.gradle
文件(该文件的顶部为顶级构建文件...文本位于顶部)并更改以下内容:
buildscript {buildscript {\n repositories {
储存库{\n google() //add this
google()//添加此\n mavenLocal() //add this
mavenLocal()//添加此\n jcenter()
jcenter()\n }
}\n dependencies {
依赖项{\n classpath 'com.android.tools.build:gradle:3.0.0' //change this
classpath'com.android.tools.build:gradle:3.0.0'//更改\n\n
\n\n}// NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }
}\n\nallprojects {
所有项目{\n repositories {
储存库{\n google() //add this
google()//添加此\n mavenLocal()
mavenLocal()\n jcenter()
jcenter()\n maven {
专家{\n // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
//所有React Native(JS,Obj-C源代码,Android二进制文件)都是从npm安装的\n url "$rootDir/../node_modules/react-native/android"
网址“ $ rootDir /../ node_modules / react-native / android”\n }
}\n }
}\n}
}
hit sync on the yellow toolbar (after project syncs you might be prompted to update the buildToolsVersion
to '26.0.2'
do that and sync again. 在黄色工具栏上单击“同步”(在项目同步之后,系统可能会提示您将
buildToolsVersion
更新为“ buildToolsVersion
'26.0.2'
,然后再次同步。
Try to run/build your app to emulator 尝试运行/构建您的应用程序以进行仿真
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.