android-studio - Gradle works with Android Studio but cmd script fails
问题描述
I freshly installed Android Studio and created a HelloWorld project. It works fine. But when I tried to build it via commandline gradlew script found in the project directory it first gave me the error that java is not installed.
After installing the java its now giving me the error:
FAILURE: Build failed with an exception.
What went wrong: Could not determine java version from '11.0.1'.
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
Following image shows the java version and the command I executed:
Note: I am running it on a Mac with MacOS High Sierra (10.13.6)
解决方案
这与我的 gradle 版本有关。我通过从侧面菜单中选择Project Structure并将 Gradle 版本设置为 4.10.2 将版本设置为最新。
推荐阅读
- google-chrome-extension - 有什么方法可以禁用 chrome 扩展但不隐藏图标
- java - 如何使用 Bouncy Castle 从 CSR 创建 X509 以使用公钥验证签名
- applescript - 无法使用 Apple 脚本打开要写入的文本文件
- regex - 从文件名中删除字符串未按预期工作
- c# - 可以将 ReadAllText 与 listBox.SelectedItem 一起使用吗?
- mysql - 在 MySQL 中对两个表中的数据进行分组
- python - 如何解决搜索字符串功能的问题?
- python - 为什么将数据框传递给 list.extend() 会导致仅列名存储在列表中?
- javascript - KeystoneJS 中是否有任何功能可以仅加载一个类别的相关项目?
- angular - 如何从 Angular 中的表情符号中删除边界。用 ngx-emoji 试过了