尝试为我的设备构建反应本机

时间:2018-02-09 17:50:51

标签: android react-native-android

我正在尝试构建我的本机应用程序。但我一直收到此错误enter image description here

  • 出了什么问题: 配置项目':app'时出现问题。

      

    无法在:C:\ sdk

    中找到带有哈希字符串'android-23'的目标
  • 尝试: 使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获得更多日志输出。

建立失败

2 个答案:

答案 0 :(得分:0)

SDK Manager 上,请务必选中" 显示包描述" ;那么您还应该选择" Google API "对于您愿意安装的版本。

安装它然后你应该没事......

希望它能帮助你......

答案 1 :(得分:0)

我设置好本机应用程序后,通常打开Android Studio,然后从那里打开android项目(选择打开,导航到app文件夹,然后选择里面的android app文件夹),

  • 当它加载时,如果你没有它,你会被提示安装缺失(sdk-23)。
  • 然后还转到项目的build.gradle文件(顶层构建文件...文本在顶部)并更改以下内容:

    buildscript {
        repositories {
            google() //add this
            mavenLocal() //add this
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.0.0' //change this
    
    
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
    
    } allprojects { repositories { google() //add this mavenLocal() jcenter() maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url "$rootDir/../node_modules/react-native/android" } } }
  • 在黄色工具栏上点击同步(项目同步后,系统可能会提示您将buildToolsVersion更新为'26.0.2'并再次同步。

  • 尝试运行/构建您的应用程序到模拟器

相关问题