简体   繁体   English

反应原生Android Gradle失败

[英]React Native Android Gradle Fail

I'm trying to get a ReactNative Android app up and running, but after going through the initial setup guide, I get the error: 我正在尝试启动并运行ReactNative Android应用程序,但是在完成了初始设置指南后,出现了以下错误:

Error:Failed to find target with hash string 'android-26' in: /Users/nicholasstephan/Library/Android/sdk 错误:在/ Users / nicholasstephan / Library / Android / sdk中找不到哈希字符串为“ android-26”的目标
Install missing platform(s) and sync project 安装缺少的平台并同步项目

I don't want to install and use SDK v26, React Native specifically uses v23.0.1. 我不想安装和使用SDK v26,React Native特别使用v23.0.1。 I'm not sure where that reference to v26 comes from. 我不确定对v26的引用来自何处。

Any ideas where that reference to android-26 could be coming from? 任何有关android-26的想法可能来自哪里?

Either you are saying that it should compile with Android 26 (targeting and compiling could have two different target versions) or some of your dependencies are asking for that specific version. 您是说它应该与Android 26一起编译(目标和编译可能具有两个不同的目标版本),或者您的某些依赖项要求该特定版本。

Check all your node-modules for build.gradle and settings.gradle files. 检查所有节点模块的build.gradle和settings.gradle文件。

This is due to maven repo URL, I faced same issue in android studio As it can't find android-26 but it can 26 这是由于Maven Repo URL,我在android studio中遇到了相同的问题,因为它找不到android-26但是它可以26

I suggest to check 我建议检查

1 . 1。 youProject/android/app/build.gradle

2 . 2。 youProject/android/app/src/main/AndroidManifest.xml

and search for 'android-26' string and make it just 26 In my case it was compileSdkVersion 'android-26' so I change it to compileSdkVersion '26' 并搜索'android-26'字符串并将其设置为26就我而言,它是compileSdkVersion 'android-26'因此我将其更改为compileSdkVersion '26'

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM