centos6.6 安装adb环境

Posted biangbiang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos6.6 安装adb环境相关的知识,希望对你有一定的参考价值。

a.安装JDK环境

centos linux JAVA(openjdk)软件包名
1.java-1.7.0-openjdk (OpenJDK Runtime Environment)
2.java-1.7.0-openjdk-devel (OpenJDK Development Environment)
 
yum install java-1.7.0-openjdk  java-1.7.0-openjdk-devel

坑1: 之前因为没有装”java-1.7.0-openjdk-devel”,所以系统里只有jre而没有jdk。后续在执行gradle命令时一直报错

Could not find tools.jar. Please check that /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-0.b15.el6_8.x86_64/jre contains a valid JDK installation.

后再重新安装了 java-1.7.0-openjdk  java-1.7.0-openjdk-devel之后,问题解决。

 

b.下载androidSdk

cd /opt

mkdir androidSdk

wget https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip

unzip sdk-tools-linux-3859397.zip

b-1. 配置环境变量

#vim /etc/profile

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL
export PATH=$PATH:/opt/androidSdk/tools/bin

#source /etc/profile

b-2. 查看已安装信息

sdkmanager --list

    ......
  system-images;a...pis;armeabi-v7a | 6            | Google APIs ARM EABI v7a Syste...
  system-images;a...google_apis;x86 | 6            | Google APIs Intel x86 Atom Sys...
  system-images;a...gle_apis;x86_64 | 6            | Google APIs Intel x86 Atom_64 ...
  system-images;a...;android-tv;x86 | 3            | Android TV Intel x86 Atom Syst...
  system-images;a...ndroid-wear;x86 | 1            | Android Wear Intel x86 Atom Sy...
  system-images;a...google_apis;x86 | 4            | Google APIs Intel x86 Atom Sys...
  system-images;a...s_playstore;x86 | 4            | Google Play Intel x86 Atom Sys...
  tools                             | 26.0.2       | Android SDK Tools                

Available Updates:
  ID      | Installed | Available
  ------- | -------   | -------  
  tools   | 26.0.1    | 26.0.2

安装需要的包,如:

sdkmanager "build-tools;26.0.2"

坑2:通过这种方法默认安装的platform-tools 下载的是26,在使用adb命令时一直报如下的错:

 

升级lib库无效后,想到可以下载低版本的platform-tools,此问题解决。

platform tools下载地址

http://downloads.puresoftware.org/files/android/platform-tools/

c.配置环境变量  vim /etc/profile

...
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL
export PATH=$PATH:/opt/androidSdk/tools/bin
export PATH=$PATH:/opt/androidSdk/platform-tools
...

然后执行更新生效
#source /etc/profile

 

d.执行adb命令

-bash: /opt/androidSdk/platform-tools/adb: /lib/ld-linux.so.2: bad ELF interpreter: 没有那个文件或目录

原来是因为系统的问题,因为我的系统是64位的,那adb这个程序是32位的

解决方案:
yum install glibc.i686
yum install libstdc*
yum install libstdc++.so.6

坑3: install的过程中一直报错:

错误: Multilib version problems found. This often means that the root
      cause is something else and multilib version checking is just
      pointing out that there is a problem. Eg.:
      
        1. You have an upgrade for nss-softokn-freebl which is missing some
           dependency that another package requires. Yum is trying to
           solve this by installing an older version of nss-softokn-freebl of the
           different architecture. If you exclude the bad architecture
           yum will tell you what the root cause is (which package
           requires what). You can try redoing the upgrade with
           --exclude nss-softokn-freebl.otherarch ... this should give you an error
           message showing the root cause of the problem.
      
        2. You have multiple architectures of nss-softokn-freebl installed, but
           yum can only see an upgrade for one of those arcitectures.
           If you dont want/need both architectures anymore then you
           can remove the one with the missing update and everything
           will work.
      
        3. You have duplicate versions of nss-softokn-freebl installed already.
           You can use "yum check" to get yum show these errors.
      
      ...you can also use --setopt=protected_multilib=false to remove
      this checking, however this is almost never the correct thing to
      do as something else is very likely to go wrong (often causing
      much more problems).
      
      Protected multilib versions: nss-softokn-freebl-3.14.3-900.23.3.el6.x86_64 != nss-softokn-freebl-3.14.3-22.el6_6.i686

试过想删除这个冲突库,然后再重新install   “nss-softokn-freebl-3.14.3-900.23.3.el6.x86_64”

但是删除掉之后引发了很多系统问题,如yum,ssh,vim等命令均不支持。 强烈建议大家不要乱删库啊,血和泪的教训啊 ~~~

 

系统恢复后,发现其实错误信息里已经给出了很直接的忽略检查的参数,直接用就好了。。

yum install glibc.i686 --setopt=protected_multilib=false

安装成功~~ 问题解决。

再次运行adb命令 ~~ 成功~ 

 


以上是关于centos6.6 安装adb环境的主要内容,如果未能解决你的问题,请参考以下文章

centos6.6-zabbix2.4.5安装实战

Centos6.6用yum快速安装LA(N)MP

centos6.6 安装MariaDB

CentOS6.6 部署Apache+Svn

centos6.6 安装htop

centos6.6 安装 glances