You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React Native开发中Android SDK未找到问题求助(Android Studio 4.0.0)

Fixing Android SDK Not Found with React Native 0.62.2 & Android Studio 4.0.0 (Windows)

I’ve dealt with this exact headache before—Android Studio 4.0.0 changed some SDK default paths and permissions that play poorly with React Native 0.62.2’s older CLI tools. Let’s walk through the fixes that actually work when the standard online solutions fail:

1. Double-Check Your Android SDK Path (AS 4.0 Has a Quirk)

Android Studio 4.0 might have tucked your SDK in a spot React Native isn’t expecting. Here’s how to track it down and set it properly:

  • Open Android Studio, go to File > Settings > Appearance & Behavior > System Settings > Android SDK
  • Copy the Android SDK Location (usually C:\Users\<YourName>\AppData\Local\Android\Sdk, but it can vary)
  • Update your system environment variables:
    • Create or edit the ANDROID_HOME variable to point to that path
    • Add these three entries to your PATH variable:
      • %ANDROID_HOME%\platform-tools
      • %ANDROID_HOME%\tools
      • %ANDROID_HOME%\tools\bin
  • Close and reopen your terminal/PowerShell (even admin ones) to make sure the changes stick

2. Manually Install the Required SDK 28.0.3 (Skip the Doctor for This Step)

Since react-native doctor is throwing permission errors, let’s install the SDK directly through Android Studio—it avoids those permission hoops:

  • In the Android SDK Settings screen, go to the SDK Platforms tab
  • Check the box for Android 9.0 (Pie) (this is the SDK 28 release React Native 0.62.2 needs)
  • Switch to the SDK Tools tab, check the Show Package Details box at the bottom
  • Expand Android SDK Build-Tools, then select version 28.0.3
  • Click Apply—if you get a permission prompt, let Android Studio handle it (even if you’re running as admin, it might need explicit access)

3. Fix the Permission Denied Error for React Native Doctor

If you still can’t get react-native doctor to fix things, try these tricks:

  • Open PowerShell as Administrator, then navigate directly to your React Native project folder (don’t run the command from a random directory)
  • Run react-native doctor --fix-errors from the project root—sometimes the context of the project folder helps with permissions
  • If that fails, manually grant full control to your SDK folder:
    • Right-click the SDK folder (from step 1) > Properties > Security > Edit
    • Select your user account, check the Full Control box under Allow, then click Apply and OK

4. Verify Everything’s Working

Once you’ve done the above, run these commands to confirm:

react-native info

You should now see your Android SDK listed under the SDKs section. Then run:

react-native doctor

The Android SDK error should be gone, and you can proceed to build your app.


内容的提问来源于stack exchange,提问作者rzar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.08 11:27:57