自学内容网 自学内容网

android-sdk 安装脚本

android-sdk 安装脚本 androidSdk_install.sh


#!/bin/bash
#[描述] android-sdk 安装

# set -eu
shopt -s expand_aliases

Android_SDK_D=/app5/android-sdk-home/

JAVA17_D=/app/zulu17.48.15-ca-jdk17.0.10-linux_x64/


#jdk17下载、解压
#https://www.azul.com/downloads/?version=java-17-lts&os=linux&architecture=x86-32-bit&package=jdk#zulu
#https://static.azul.com/zulu/bin?C=S;O=D
JDK17_Url=https://static.azul.com/zulu/bin/zulu17.48.15-ca-jdk17.0.10-linux_x64.zip
$JAVA17_D/bin/javac -version 2>/dev/null || ( cd /app/pack/ && axel -n 5 $JDK17_Url && unzip zulu17.48.15-ca-jdk17.0.10-linux_x64.zip -d /app/ ;)

#AndroidSDK/commandlinetools 下载、解压
AndroidSDK_commandlinetools_D=/app5/AndroidSDK_commandlinetools
AndroidSDK_commandlinetools_url=https://mirrors.cloud.tencent.com/AndroidSDK/commandlinetools-linux-12266719_latest.zip
( cd /app/pack && [[ ! -f ./commandlinetools-linux-12266719_latest.zip ]] && axel -n 5 $AndroidSDK_commandlinetools_url ;)

[[ ! -f $AndroidSDK_commandlinetools_D/cmdline-tools/bin/sdkmanager ]] && unzip -qq commandlinetools-linux-12266719_latest.zip  -d $AndroidSDK_commandlinetools_D

#android-sdk安装
alias alias_sdkmanager='JAVA_HOME=$JAVA17_D $AndroidSDK_commandlinetools_D/cmdline-tools/bin/sdkmanager  --sdk_root=$Android_SDK_D'

alias_sdkmanager --list_installed

alias_sdkmanager --list | grep 34
#build-tools;34.0.0   | 34.0.0 | Android SDK Build-Tools 34
#platforms;android-34 | 3      | Android SDK Platform 34
#sources;android-34   | 2      | Sources for Android 34 
alias_sdkmanager  --install 'build-tools;34.0.0'   'platforms;android-34'   'sources;android-34'


#报错: Android Installed Build Tools revision 34.0.0 is corrupted. Remove and install again using the SDK
#修复方法:
dir34=$Android_SDK_D/build-tools/34.0.0
lib34=$dir34/lib
[[ ! -f $dir34/dx ]]     &&  ln -s $dir34/d8     $dir34/dx  
[[ ! -f $lib34/dx.jar ]] &&  ln -s $lib34/d8.jar $lib34/dx.jar


原文地址:https://blog.csdn.net/hfcaoguilin/article/details/144011926

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!