美文网首页自动化测试软件测试测试员的那点事
[ubuntu server 16.04下的安装脚本] 7.一键

[ubuntu server 16.04下的安装脚本] 7.一键

作者: cooling2016 | 来源:发表于2018-02-22 15:43 被阅读79次

    前提:本机已安装配置好JDK。
    若未安装JDK,请参考下文:
    1.《Ubuntu16.04一键安装jdk》进行操作

    1.一键安装 android sdk

     #!/bin/bash  
    #this shell to use installing android_sdk
    
    echo "this shell to use installing android_sdk"
    
    echo "------------------start to install android_sdk----------------------"
    
    #sudo su #切换到root权限
    
    cd /opt
    
    #download android_sdk
    
    wget  https://dl.google.com/android/android-sdk_r24.4.1-linux.tgz
    
    #extract android_sdk
    tar -zxvf  android-sdk_r24.4.1-linux.tgz
    
    #set environment
    export ANDROID_HOME="/opt/android-sdk-linux"
    if ! grep "ANDROID_HOME=/opt/android-sdk-linux" /etc/profile 
    then
    echo "ANDROID_HOME=/opt/android-sdk-linux" | sudo tee -a /etc/profile
    echo "export ANDROID_HOME" | sudo tee -a /etc/profile
    
    echo "PATH=${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:$PATH" | sudo tee -a /etc/profile
    echo "export PATH" | sudo tee -a /etc/profile
    fi
    
    #update profile
    source /etc/profile  
    
    
    sudo update-alternatives --install /usr/bin/android android /opt/android-sdk-linux/tools/android 360
    sudo update-alternatives --install /usr/bin/adb adb /opt/android-sdk-linux/platform-tools/adb 361
    
    
    
    #----------------------------------------------------
    
    #自行安装选择安装需要的API版本[适用于windows与linux;macox没有试过]
    
    #[android update sdk --no-ui]更新下载最新的sdk
    #[android update sdk --no-ui --all ]更新下载最新的所有sdk
    
    echo "自行安装选择安装需要的API版本"
    
    echo "install api21---android5.0.2"
    #install api21---android5.0.2
    #android update sdk --no-ui -u --all --filter platform-tools,android-21
    
    sudo android update sdk  --no-ui --all --filter platform-tools,android-22
    
    #----------------------------------------------------
    
    #验证adb是否可用
    adb version
    
    echo "#----------------------over----------"
    

    相关文章

      网友评论

      • AleiHsu:执行了没有成功,不知道为什么,最后用
        sudo apt install adb
        安装的。不知道有什么区别没有!
        cooling2016:@AleiHsu 建议用源码包
      • AleiHsu:1.《Ubuntu16.04一键安装jdk》进行操作 文章链接跳转错了!
        cooling2016:@AleiHsu 有空我调试下,我当时是对的
      • AleiHsu:您好:这种问题怎么解决呢?

        aleihsu@ubuntu:~$ stf doctor
        2018-03-22T07:02:05.078Z INF/cli:doctor 26526 [*] OS Arch: x64
        2018-03-22T07:02:05.080Z INF/cli:doctor 26526 [*] OS Platform: linux
        2018-03-22T07:02:05.080Z INF/cli:doctor 26526 [*] OS Platform: 4.13.0-37-generic
        2018-03-22T07:02:05.080Z INF/cli:doctor 26526 [*] Using Node 9.8.0
        2018-03-22T07:02:05.185Z ERR/cli:doctor 26526 [*] Unexpected error checking ZeroMQ: Error: Could not locate the bindings file. Tried:
        → /usr/local/lib/node_modules/stf/node_modules/zmq/build/zmq.node
        → /usr/local/lib/node_modules/stf/node_modules/zmq/build/Debug/zmq.node
        → /usr/local/lib/node_modules/stf/node_modules/zmq/build/Release/zmq.node
        → /usr/local/lib/node_modules/stf/node_modules/zmq/out/Debug/zmq.node
        → /usr/local/lib/node_modules/stf/node_modules/zmq/Debug/zmq.node
        → /usr/local/lib/node_modules/stf/node_modules/zmq/out/Release/zmq.node
        → /usr/local/lib/node_modules/stf/node_modules/zmq/Release/zmq.node
        → /usr/local/lib/node_modules/stf/node_modules/zmq/build/default/zmq.node
        → /usr/local/lib/node_modules/stf/node_modules/zmq/compiled/9.8.0/linux/x64/zmq.node
        2018-03-22T07:02:05.196Z INF/cli:doctor 26526 [*] Using RethinkDB 2.3.6~0xenial
        2018-03-22T07:02:05.203Z INF/cli:doctor 26526 [*] Using GraphicsMagick 1.3.23
        2018-03-22T07:02:05.205Z INF/cli:doctor 26526 [*] Using ProtoBuf 3.5.1
        2018-03-22T07:02:05.205Z INF/cli:doctor 26526 [*] Using ADB 1.0.32
        aleihsu@ubuntu:~$

      本文标题:[ubuntu server 16.04下的安装脚本] 7.一键

      本文链接:https://www.haomeiwen.com/subject/eflztftx.html