【问题标题】:react-native run-android android-sdk does not existsreact-native run-android android-sdk 不存在
【发布时间】:2015-12-20 22:22:33
【问题描述】:

我正在 Windows 10 系统上执行 react-native Getting Started。我能够执行react-native init AwesomeProject 命令来工作,现在我需要执行:

>react-native run-android

但失败并出现此错误:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> The SDK directory 'C:\Users\plankton\AppData\Local\Android\android-sdk' does not exist.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 2 mins 0.64 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html

我认为问题在于我安装了最新的 Android SDK,现在路径是:C:\Users\plankton\AppData\Local\Android\sdk 而不是C:\Users\plankton\AppData\Local\Android-sdk。如果我在像操作系统这样的 Unix 上,我会创建一个系统链接。但我使用的是 Windows 10。我该怎么办?如何在 Windows 中创建系统链接?

【问题讨论】:

    标签: android windows react-native


    【解决方案1】:

    在 Windows 上,它查看 ANDROID_HOME 环境变量。您应该能够更新它,关闭命令提示符或 powershell 并重新启动它,然后重试。

    【讨论】:

      【解决方案2】:

      在 Android 的 local.properties 里面更改你的 SDK位置并解决这个问题

      1 react-native start --reset-cache

      然后转到 android 文件夹 光盘安卓 然后清理 gradle

      2 gradlew 清洁

      并确保卸载以前的应用程序

      【讨论】:

        猜你喜欢
        • 2021-11-14
        • 2017-05-12
        • 1970-01-01
        • 1970-01-01
        • 2021-09-18
        • 1970-01-01
        • 2020-09-08
        • 1970-01-01
        相关资源
        最近更新 更多