centos 8 使用sdkmanager去更新tools时报错

fabbymee 2021-05-14 04:54:46
我用的是最新的commandlinetools-linux-7302050_latest.zip
sudo unzip android-sdk.zip -d .
sudo ./cmdline-tools/bin/sdkmanager "tools"
ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
...全文
317 1 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
fabbymee 2021-05-16
  • 打赏
  • 举报
回复
sudo ./cmdline-tools/bin/sdkmanager "tools" ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation. cmdline-tools/bin/sdkmanager文件有下面的代码 # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables JAVACMD="$JAVA_HOME/jre/sh/java" else JAVACMD="$JAVA_HOME/bin/java" fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else JAVACMD="java" which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi 但是sudo which java which: no java in (/sbin:/bin:/usr/sbin:/usr/bin)会报错 ./cmdline-tools/bin/sdkmanager "tools" Error: Could not determine SDK root. Error: Either specify it explicitly with --sdk_root= or move this package into its expected location: <sdk>/cmdline-tools/latest/ 改用下面 ./cmdline-tools/bin/sdkmanager "tools" --sdk_root=/home/android/android_sdk/sdk

80,472

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧