Created
May 25, 2021 11:01
-
-
Save hacker1024/81841c42277cb454640935f5a823a2fa to your computer and use it in GitHub Desktop.
A script to patch the legacy Android SDK Tools to work on modern Java versions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Patches the legacy Android SDK Tools to work on modern Java versions. | |
# Inspired by https://stackoverflow.com/a/55982976. | |
if (( "$(uname)" == "Darwin" )); then | |
[[ "$(command -v gsed)" ]] || { echo "gsed is required!" 1>&2 ; exit 1; } | |
SED_CMD=gsed | |
else | |
[[ "$(command -v sed)" ]] || { echo "sed is required!" 1>&2 ; exit 1; } | |
SED_CMD=sed | |
fi | |
LIB_DIR=jaxb_lib | |
[ -d $LIB_DIR ] || mkdir $LIB_DIR | |
[[ -a $LIB_DIR/activation.jar ]] || { WGETS="wget https://repo1.maven.org/maven2/javax/activation/activation/1.1.1/activation-1.1.1.jar -O $LIB_DIR/activtion.jar"; } | |
[[ -a $LIB_DIR/jaxb-api.jar ]] || { WGETS="$WGETS; wget https://repo1.maven.org/maven2/javax/xml/bind/jaxb-api/2.3.1/jaxb-api-2.3.1.jar -O $LIB_DIR/jaxb-api.jar"; } | |
[[ -a $LIB_DIR/jaxb-core.jar ]] || { WGETS="$WGETS; wget https://repo1.maven.org/maven2/org/glassfish/jaxb/jaxb-core/2.3.0.1/jaxb-core-2.3.0.1.jar -O $LIB_DIR/jaxb-core.jar"; } | |
[[ -a $LIB_DIR/jaxb-impl.jar ]] || { WGETS="$WGETS; wget https://repo1.maven.org/maven2/com/sun/xml/bind/jaxb-impl/2.3.4/jaxb-impl-2.3.4.jar -O $LIB_DIR/jaxb-impl.jar"; } | |
[[ -a $LIB_DIR/jaxb-xjc.jar ]] || { WGETS="$WGETS; wget https://repo1.maven.org/maven2/com/sun/xml/bind/jaxb-xjc/2.3.4/jaxb-xjc-2.3.4.jar -O $LIB_DIR/jaxb-xjc.jar"; } | |
[[ -a $LIB_DIR/jaxb-jxc.jar ]] || { WGETS="$WGETS; wget https://repo1.maven.org/maven2/org/glassfish/jaxb/jaxb-jxc/2.3.4/jaxb-jxc-2.3.4.jar -O $LIB_DIR/jaxb-jxc.jar"; } | |
eval $WGETS | |
$SED_CMD -ie 's%^CLASSPATH=.*%\0:$APP_HOME/'"$LIB_DIR"'/*%' bin/sdkmanager bin/avdmanager |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment