Docker image and scripts for flutter/rust/android development in vscode.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

52 lines
1.6 KiB

#!/bin/bash
set -e
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$SCRIPT_DIR/dev.env"
: ${ANDROID_SDK_ROOT:=/opt/android-sdk}
: ${ANDROID_VERSION:=34}
: ${ANDROID_BUILD_TOOLS_VERSION:=34.0.0}
: ${ANDROID_ARCHITECTURE:=x86_64}
: ${ANDROID_TOOLS_URL:="http://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip"}
if [ ! -d $ANDROID_SDK_ROOT/cmdline-tools ]; then
cd /tmp
# Download and install Android SDK
wget -c $ANDROID_TOOLS_URL -O android-sdk.zip && \
unzip android-sdk.zip -d /tmp && rm android-sdk.zip && \
mkdir -p $ANDROID_SDK_ROOT/cmdline-tools/latest && \
mv /tmp/cmdline-tools/* $ANDROID_SDK_ROOT/cmdline-tools/latest/
fi
SDKMANAGER="$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager"
yes | $SDKMANAGER --licenses
# Install SDK Platform Tools
$SDKMANAGER --install "platform-tools"
$SDKMANAGER --install "platforms;android-$ANDROID_VERSION"
$SDKMANAGER --install "build-tools;$ANDROID_BUILD_TOOLS_VERSION"
$SDKMANAGER --install "system-images;android-${ANDROID_VERSION};google_apis_playstore;${ANDROID_ARCHITECTURE}"
$SDKMANAGER --install "emulator"
# for vscode android plugin:
mkdir -p ~/Library/Android/ ||:
ln -sf /opt/android-sdk/ ~/Library/Android/sdk ||:
# Build demo project if present
if [ -d "$ANDROID_SAMPLE_PROJECT" ]; then
"$ANDROID_SAMPLE_PROJECT/build.sh"
else
echo "Android demo project not found at $ANDROID_SAMPLE_PROJECT"
fi
flutter config --android-sdk $ANDROID_SDK_ROOT
flutter emulators --create
echo "Android development environment setup completed successfully!"