Gradle包装器构建失败:SDK目录不存在?

时间:2019-06-20 08:19:16

标签: android bash gradle windows-subsystem-for-linux

我正在尝试使用gradle在WSL中构建一个android项目。但是,当我在项目的根目录中执行命令gradle wrapper时,会出现以下错误:

* What went wrong:
A problem occurred configuring project ':app'.
> The SDK directory '/mnt/c/<path_till_root_directory>/C:\Users\<username>\AppData\Local\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. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings    

我的loacal.properties文件夹设置了正确的路径:

sdk.dir=C:\\Users\\<username>\\AppData\\Local\\Android\\Sdk

对于此问题,我有一个“可能正在工作”的修复程序。我将Sdk文件夹复制到了项目的根目录,并将sdk.dir=C:\\Users\\<username>\\AppData\\Local\\Android\\Sdk中的local.properties更改为sdk.dir=Sdk

它奏效了,但不适用于所有项目。不过,我不建议您在每个项目的根目录中复制Sdk。

有人可以告诉我如何解决此问题吗?

0 个答案:

没有答案