@@ -18,30 +18,21 @@ rm "${ANDROID_SDK_ROOT}/cmdline-tools.zip"
1818# Properly setup cmdline-tools directory according to the latest structure required by SDK Manager
1919mkdir -p " ${ANDROID_SDK_ROOT} /cmdline-tools/latest"
2020mv " ${ANDROID_SDK_ROOT} /cmdline-tools-temp/cmdline-tools/" * " ${ANDROID_SDK_ROOT} /cmdline-tools/latest"
21- # Fix for the non-empty temporary directory issue
2221rm -rf " ${ANDROID_SDK_ROOT} /cmdline-tools-temp"
2322
2423# Create the 'tools' directory and clear its contents if it exists
2524mkdir -p " ${ANDROID_SDK_ROOT} /tools"
2625rm -rf " ${ANDROID_SDK_ROOT} /tools/" *
2726
28- # Move the cmdline-tools content to the 'tools' directory
29- mv " ${ANDROID_SDK_ROOT} /cmdline-tools/latest/" * " ${ANDROID_SDK_ROOT} /tools/"
30- rm -rf " ${ANDROID_SDK_ROOT} /cmdline-tools/latest" # Optionally remove the now empty directory
27+ # Copy the cmdline-tools content to the 'tools' directory (using copy to keep original)
28+ cp -r " ${ANDROID_SDK_ROOT} /cmdline-tools/latest/" * " ${ANDROID_SDK_ROOT} /tools/"
3129
3230# Download and extract Android NDK
3331NDK_VERSION=" r26b" # Corrected NDK version
3432NDK_URL=" https://dl.google.com/android/repository/android-ndk-${NDK_VERSION} -linux.zip"
3533wget " ${NDK_URL} " -O " ${ANDROID_NDK_ROOT} /ndk.zip"
3634unzip -d " ${ANDROID_NDK_ROOT} " " ${ANDROID_NDK_ROOT} /ndk.zip"
3735rm " ${ANDROID_NDK_ROOT} /ndk.zip"
38- # Initialize sdkmanager and accept licenses
39- yes | ${ANDROID_SDK_ROOT} /tools/bin/sdkmanager --licenses
40-
41- # Install SDK packages required by Qt for Android development
42- # Note: Specify exact versions or latest available
43- ${ANDROID_SDK_ROOT} /tools/bin/sdkmanager " platforms;android-29" " build-tools;29.0.3" " platform-tools"
44-
4536# Move the content up and remove the versioned directory
4637mv " ${ANDROID_NDK_ROOT} /android-ndk-${NDK_VERSION} " /* " ${ANDROID_NDK_ROOT} /"
4738rm -rf " ${ANDROID_NDK_ROOT} /android-ndk-${NDK_VERSION} "
@@ -52,13 +43,23 @@ ANDROID_NDK_ROOT="${ANDROID_NDK_ROOT}/" # Already correctly set
5243# Set environment variables
5344export ANDROID_SDK_ROOT
5445export ANDROID_NDK_ROOT
55- export PATH=" ${PATH} :${ANDROID_SDK_ROOT} /tools/bin:${ANDROID_NDK_ROOT} "
46+ export PATH=" ${PATH} :${ANDROID_SDK_ROOT} /cmdline-tools/latest/bin: ${ANDROID_SDK_ROOT} / tools/bin:${ANDROID_NDK_ROOT} "
5647
5748# Optional: Add environment variables to your .bashrc or .bash_profile
5849echo " export ANDROID_SDK_ROOT=${ANDROID_SDK_ROOT} " >> ~ /.bashrc
5950echo " export ANDROID_NDK_ROOT=${ANDROID_NDK_ROOT} " >> ~ /.bashrc
60- echo " export PATH=\$ {PATH}:${ANDROID_SDK_ROOT} /tools/bin:${ANDROID_NDK_ROOT} " >> ~ /.bashrc
51+ echo " export PATH=\$ {PATH}:${ANDROID_SDK_ROOT} /cmdline-tools/latest/bin: ${ANDROID_SDK_ROOT} / tools/bin:${ANDROID_NDK_ROOT} " >> ~ /.bashrc
6152
53+ # Initialize sdkmanager and accept licenses
54+ yes | ${ANDROID_SDK_ROOT} /cmdline-tools/latest/bin/sdkmanager --licenses
55+ yes | ${ANDROID_SDK_ROOT} /tools/bin/sdkmanager --licenses
56+
57+ # Install SDK packages required by Qt for Android development
58+ # Note: Specify exact versions or latest available
59+ ${ANDROID_SDK_ROOT} /cmdline-tools/latest/bin/sdkmanager " platforms;android-29" " build-tools;29.0.3" " platform-tools"
60+ ${ANDROID_SDK_ROOT} /tools/bin/sdkmanager " platforms;android-29" " build-tools;29.0.3" " platform-tools"
6261
6362echo " Android SDK and NDK installation completed."
64- cd
63+ cd
64+
65+ # Entirely generated by ChatGPT lmao
0 commit comments