Skip to content

Commit

Permalink
- god pls make that work
Browse files Browse the repository at this point in the history
  • Loading branch information
EchterAlsFake committed Apr 13, 2024
1 parent 6ee9402 commit f665521
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions android_sdk_ndk_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,21 @@ rm "${ANDROID_SDK_ROOT}/cmdline-tools.zip"
# Properly setup cmdline-tools directory according to the latest structure required by SDK Manager
mkdir -p "${ANDROID_SDK_ROOT}/cmdline-tools/latest"
mv "${ANDROID_SDK_ROOT}/cmdline-tools-temp/cmdline-tools/"* "${ANDROID_SDK_ROOT}/cmdline-tools/latest"
# Fix for the non-empty temporary directory issue
rm -rf "${ANDROID_SDK_ROOT}/cmdline-tools-temp"

# Create the 'tools' directory and clear its contents if it exists
mkdir -p "${ANDROID_SDK_ROOT}/tools"
rm -rf "${ANDROID_SDK_ROOT}/tools/"*

# Move the cmdline-tools content to the 'tools' directory
mv "${ANDROID_SDK_ROOT}/cmdline-tools/latest/"* "${ANDROID_SDK_ROOT}/tools/"
rm -rf "${ANDROID_SDK_ROOT}/cmdline-tools/latest" # Optionally remove the now empty directory
# Copy the cmdline-tools content to the 'tools' directory (using copy to keep original)
cp -r "${ANDROID_SDK_ROOT}/cmdline-tools/latest/"* "${ANDROID_SDK_ROOT}/tools/"

# Download and extract Android NDK
NDK_VERSION="r26b" # Corrected NDK version
NDK_URL="https://dl.google.com/android/repository/android-ndk-${NDK_VERSION}-linux.zip"
wget "${NDK_URL}" -O "${ANDROID_NDK_ROOT}/ndk.zip"
unzip -d "${ANDROID_NDK_ROOT}" "${ANDROID_NDK_ROOT}/ndk.zip"
rm "${ANDROID_NDK_ROOT}/ndk.zip"
# Initialize sdkmanager and accept licenses
yes | ${ANDROID_SDK_ROOT}/tools/bin/sdkmanager --licenses

# Install SDK packages required by Qt for Android development
# Note: Specify exact versions or latest available
${ANDROID_SDK_ROOT}/tools/bin/sdkmanager "platforms;android-29" "build-tools;29.0.3" "platform-tools"

# Move the content up and remove the versioned directory
mv "${ANDROID_NDK_ROOT}/android-ndk-${NDK_VERSION}"/* "${ANDROID_NDK_ROOT}/"
rm -rf "${ANDROID_NDK_ROOT}/android-ndk-${NDK_VERSION}"
Expand All @@ -52,13 +43,23 @@ ANDROID_NDK_ROOT="${ANDROID_NDK_ROOT}/" # Already correctly set
# Set environment variables
export ANDROID_SDK_ROOT
export ANDROID_NDK_ROOT
export PATH="${PATH}:${ANDROID_SDK_ROOT}/tools/bin:${ANDROID_NDK_ROOT}"
export PATH="${PATH}:${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin:${ANDROID_SDK_ROOT}/tools/bin:${ANDROID_NDK_ROOT}"

# Optional: Add environment variables to your .bashrc or .bash_profile
echo "export ANDROID_SDK_ROOT=${ANDROID_SDK_ROOT}" >> ~/.bashrc
echo "export ANDROID_NDK_ROOT=${ANDROID_NDK_ROOT}" >> ~/.bashrc
echo "export PATH=\${PATH}:${ANDROID_SDK_ROOT}/tools/bin:${ANDROID_NDK_ROOT}" >> ~/.bashrc
echo "export PATH=\${PATH}:${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin:${ANDROID_SDK_ROOT}/tools/bin:${ANDROID_NDK_ROOT}" >> ~/.bashrc

# Initialize sdkmanager and accept licenses
yes | ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --licenses
yes | ${ANDROID_SDK_ROOT}/tools/bin/sdkmanager --licenses

# Install SDK packages required by Qt for Android development
# Note: Specify exact versions or latest available
${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager "platforms;android-29" "build-tools;29.0.3" "platform-tools"
${ANDROID_SDK_ROOT}/tools/bin/sdkmanager "platforms;android-29" "build-tools;29.0.3" "platform-tools"

echo "Android SDK and NDK installation completed."
cd
cd

# Entirely generated by ChatGPT lmao

0 comments on commit f665521

Please sign in to comment.