下载好gradle并配置好环境变量后,使用gradle -v测试,报错如下:

[yan@yanwei ~]$ gradle -v

FAILURE: Build failed with an exception.

* What went wrong:
Failed to load native library 'libnative-platform.so' for Linux amd64.

* 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

这是权限问题,默认的GRADLE_USER_HOME在当前用户目录~/.gradle/下,而我指定的是/usr/local/repository,并且这个目录归root:root所有,当前(非root)用户无权写入,所以报错了。修改权限即可。

参考

https://community.bitnami.com/t/gradle-doesnt-work-libnative-platform-so/40686

Logo

鸿蒙生态一站式服务平台。

更多推荐