找不到用于 native react 的 Android SDK

标签 android react-native

互联网上到处都是类似的问题,到目前为止还没有提供有效的解决方案。
我使用的是 Android Studio 4.0.0,也许这就是问题所在。

到目前为止,我在我的系统变量中得到了这些设置:
Environment variables

还有 PATH 变量:
PATH variable

这是 react-native 信息输出的内容:

$ react-native info
info Fetching system and libraries information...
System:
    OS: Windows 10 10.0.18363
    CPU: (6) x64 Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
    Memory: 23.08 GB / 31.86 GB
  Binaries:
    Node: 12.17.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.14.4 - C:\Program Files\nodejs\npm.CMD
    Watchman: Not Found
  SDKs:
    Android SDK: Not Found
  IDEs:
    Android Studio: Version  4.0.0.0 AI-193.6911.18.40.6514223
  Languages:
    Java: 11.0.2 - /c/Users/zarifov/AppData/Local/jdk-11.0.2/bin/javac
    Python: 2.7.18 - /c/Python27/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: ~16.11.0 => 16.11.0
    react-native: ~0.62.2 => 0.62.2
  npmGlobalPackages:
    *react-native*: Not Found

而且,以防万一,react-native doctor 输出:

$ react-native doctor
Common
 ✓ Node.js
 ✓ yarn
 ✓ Python

Android
 ✓ JDK
 ✓ Android Studio - Required for building and installing your app on Android
 ✖ Android SDK - Required for building and installing your app on Android
   - Versions found: N/A
   - Version supported: 28.0.3
 ✓ ANDROID_HOME

Errors:   1
Warnings: 0

Usage
 › Press f to try to fix issues.
 › Press e to try to fix errors.
 › Press w to try to fix warnings.
 › Press Enter to exit.
Common
 ✓ Node.js
 ✓ yarn
 ✓ Python

Android
 ✓ JDK
 ✓ Android Studio - Required for building and installing your app on Android
 ✖ Android SDK - Required for building and installing your app on Android
   - Versions found: N/A
   - Version supported: 28.0.3
 ✓ ANDROID_HOME

Errors:   1
Warnings: 0

Usage
 › Press f to try to fix issues.
 › Press e to try to fix errors.
 › Press w to try to fix warnings.
 › Press Enter to exit.

其他重要信息: 尽管 PowerShell 和 IDE 是以管理员权限启动的,但尝试通过 doctor 修复 SDK 问题的尝试无法成功,因为它在尝试安装 Androd 命令行工具时失败并显示“权限被拒绝”。

最佳答案

我有一个解决方案:安装 Android SDK 命令行工具:

enter image description here

关于找不到用于 native react 的 Android SDK,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62635201/

相关文章:

ios - React Native iOS 部署错误

javascript - 客户端,如何信任来自物联网设备的自签名证书?

javascript - 我想使用 expo AsyncStorage 将存储保留为 redux,但出现错误

android - Firebase Crashlytics 有替代品吗?

android - VerifyError,类被拒绝,VFY : register1 v6 type 12, wanted 11

android - 视频应用程序随机播放视频,而不是按顺序播放

android - Qt 检查平台类型 : Mobile or Desktop

javascript - JS中的CSS,如何让props.className成为优先类

java - ApiClient 标签和其他标签已被弃用。用什么来代替?

java - 将对象从异步线程传递到 fragment 类