【问题标题】:Android Build tools not installed on Centos7Centos7 上未安装 Android 构建工具
【发布时间】:2017-09-21 14:54:26
【问题描述】:

我正在尝试设置安装在我的 CentOS 7 机器上的 Android 构建工具,作为移动项目持续集成的一部分。

我们有一个公司代理和
1) 我在 /etc/environment
中设置了代理变量 2)我已经在gradle.properties中设置了代理信息(在~/.gradle/gradle.properties中(用于构建我的移动项目)

我按照这些说明安装了 Android SDK

 #Download and Install Android SDK. 
 mkdir -p /opt/sdk-tools-linux-3859397
 cd /opt/sdk-tools-linux-3859397
 sudo wget https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
 sudo unzip sdk-tools-linux-3859397.zip
 cd /opt
 sudo chown -R root:root sdk-tools-linux-3859397
 sudo ln -s sdk-tools-linux-3859397 android-sdk

 sudo vim /etc/profile.d/android-sdk-env.sh

 # Set Android SDK Environment Value.
 export ANDROID_HOME="/opt/android-sdk"
 export PATH="$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$PATH"

 sudo source /etc/profile.d/android-sdk-env.sh


 #Update Android SDK
 /opt/android-sdk/tools/bin/sdkmanager "tools" "build-tools;26.0.0" 

最后一步是更新构建工具卡住了一段时间后我收到此错误

Info: Parsing /opt/sdk-tools-linux-3859397/tools/package.xml
Info: Parsing /opt/sdk-tools-linux-3859397/tools/package.xml
Info: IOException: https://dl.google.com/android/repository/addons_list-3.xml
Info: java.net.ConnectException: Connection timed out (Connection timed out)
Info: IOException: https://dl.google.com/android/repository/addons_list-2.xml
Info: java.net.ConnectException: Connection timed out (Connection timed out)
Info: IOException: https://dl.google.com/android/repository/addons_list-1.xml
Info: java.net.ConnectException: Connection timed out (Connection timed out)
Warning: Failed to download any source lists!

关于如何在我的构建服务器中获取构建工具的任何想法。
我经历了一些问题和解决方案,但其中许多人建议使用 Android Studio UI,我希望通过命令行安装。

我也按照Android SDK尝试了下面的命令

/opt/android-sdk/tools/bin/sdkmanager "build-tools;26.0.1" --proxy_host="uname:password@proxyhost" --proxy_port=8080

提前致谢。

【问题讨论】:

  • 看起来是网络问题
  • 如果是网络问题,那么sdk包本身的下载就会失败。如果不设置代理,下载也不会发生。我已经检查过了。
  • 为什么是sudo chown -R root:root ...?您取消了所有人的访问权限。通常/opt 的权限适用于这类事情。事实上,我将 NDK 放在那里,并且从不需要更改权限。
  • 但即使是 root 我也无法更新。

标签: android linux centos android-build


【解决方案1】:

我终于找到了解决方案。
我认为这些“代理”服务器会使生活复杂化。 我的一位同事建议使用 cntlm 代理,它工作正常。
已关注CNTLM Proxy Instructions
然后我执行了命令:

/opt/android-sdk/tools/bin/sdkmanager --no_https --proxy=http --proxy_host=127.0.0.1 --proxy_port=3128 "build-tools;26.0.1"

请注意,这次我已将代理主机和代理端口替换为 cntlm 配置。

效果很好。
但是,即使设置了系统代理,我仍然不确定为什么我们需要一个 cntlm 代理。它就像在另一个代理之上的代理。

【讨论】:

  • 这是因为微软使用的安全协议 (NTLM) 比其他所有人都多。
猜你喜欢
  • 2022-01-05
  • 2015-09-20
  • 1970-01-01
  • 1970-01-01
  • 2019-02-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多