a.安裝JDK環境java
yum install java-1.7.0-openjdk java-1.7.0-openjdk-devel
坑1: 以前由於沒有裝」java-1.7.0-openjdk-devel」,因此係統裏只有jre而沒有jdk。後續在執行gradle命令時一直報錯linux
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以後,問題解決。android
b.下載androidSdkvim
cd /opt mkdir androidSdk wget https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip unzip sdk-tools-linux-3859397.zip
b-1. 配置環境變量centos
#vim /etc/profileapi
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL
export PATH=$PATH:/opt/androidSdk/tools/bin
#source /etc/profilebash
b-2. 查看已安裝信息ssh
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
安裝須要的包,如:jvm
sdkmanager "build-tools;26.0.2"
坑2:經過這種方法默認安裝的platform-tools 下載的是26,在使用adb命令時一直報以下的錯:gradle
升級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 don't 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命令 ~~ 成功~