执行react-native run-android
时遇到多个问题中提到的错误。但是,没有一种建议的解决方案对我有用。
我在Windows 10上安装了android studio 3.5。
错误是:
Failed to find target with hash string 'android-28' in: C:\Users\<username>\AppData\Local\Android\Sdk
这是日志中与该问题有关的一部分:
Checking the license for package Android SDK Build-Tools 28.0.3 in C:\Users\yossi\AppData\Local\Android\Sdk\licenses
License for package Android SDK Build-Tools 28.0.3 accepted.
Preparing "Install Android SDK Build-Tools 28.0.3 (revision: 28.0.3)".
"Install Android SDK Build-Tools 28.0.3 (revision: 28.0.3)" ready.
Installing Android SDK Build-Tools 28.0.3 in C:\Users\yossi\AppData\Local\Android\Sdk\build-tools\28.0.3
"Install Android SDK Build-Tools 28.0.3 (revision: 28.0.3)" complete.
"Install Android SDK Build-Tools 28.0.3 (revision: 28.0.3)" finished.
Checking the license for package Android SDK Platform 28 in C:\Users\yossi\AppData\Local\Android\Sdk\licenses
License for package Android SDK Platform 28 accepted.
Preparing "Install Android SDK Platform 28 (revision: 6)".
"Install Android SDK Platform 28 (revision: 6)" ready.
Installing Android SDK Platform 28 in C:\Users\yossi\AppData\Local\Android\Sdk\platforms\android-28
"Install Android SDK Platform 28 (revision: 6)" complete.
"Install Android SDK Platform 28 (revision: 6)" finished.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Failed to find target with hash string 'android-28' in: C:\Users\yossi\AppData\Local\Android\Sdk
我将以下定义为环境。变量:
ANDROID_HOME=C:\Users\yossi\AppData\Local\Android\Sdk
在此文件夹中,我同时拥有platform-tools
和platforms
,在platforms
下,我拥有android-28
。
有什么主意吗?
答案 0 :(得分:0)
我没有找到解决方案,所以我降级到android studio 2.3,问题就不存在了(从https://android-studio.en.uptodown.com/windows/download/1500423下载了。现在我发现它在https://developer.android.com/studio/archive中也可用)。 / p>