Skip to content

Commit

Permalink
Revert "🔥 Remove the manual gradle installation"
Browse files Browse the repository at this point in the history
This reverts commit 399e9e7.

I _thought_ this wasn't needed because cordova configures `build.gradle` so
that the correct version of gradle is downloaded and installed on the first
run.

However, when I tried to rebuild on a fresh installation, I got the following error

```
Using Android SDK: /Users/kshankar/Library/Android/sdk
Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
```

It looks like although cordova installs gradle, the system needs to have a
version of gradle installed as well to bootstrap the gradle wrapper.

This error doesn't show up in the CI/CD pipeline because the CI environment has
gradle installed.

@catarial did you encounter this during your setup as well?! Or maybe it has
not been an issue so far because you are focused on the iOS build.
  • Loading branch information
shankari committed Sep 7, 2024
1 parent 1de8f78 commit 3b6ecd5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions setup/activate_native.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ then
echo "ANDROID_HOME and ANDROID_SDK_ROOT not set, android SDK not found"
fi

echo "Activating sdkman, and by default, gradle"
source ~/.sdkman/bin/sdkman-init.sh

echo "Ensuring that we use the most recent version of the command line tools"
export PATH=$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$ANDROID_SDK_ROOT/emulator:$PATH

Expand Down
1 change: 1 addition & 0 deletions setup/export_shared_dep_versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export NODE_VERSION=20.9.0
# Looks like brew supports only major and minor, not patch version
export RUBY_VERSION=3.0
export COCOAPODS_VERSION=1.15.2
export GRADLE_VERSION=8.10
export OSX_EXP_VERSION=12

export NVM_DIR="$HOME/.nvm"
Expand Down
15 changes: 15 additions & 0 deletions setup/setup_android_native.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,19 @@ else
echo "ANDROID_HOME = $ANDROID_HOME; ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT"
fi

echo "Setting up sdkman"
curl -s "https://get.sdkman.io" | bash
source ~/.sdkman/bin/sdkman-init.sh

CURR_GRADLE_VER=`sdk current gradle | cut -d " " -f 4 | xargs`

echo "CURR_GRADLE_VER = '$CURR_GRADLE_VER', expected $GRADLE_VERSION"

if [[ $CURR_GRADLE_VER == $GRADLE_VERSION ]]; then
echo "Already have gradle version $GRADLE_VERSION"
else
echo "Setting up gradle using SDKMan"
sdk install gradle $GRADLE_VERSION
fi

source setup/setup_shared_native.sh

0 comments on commit 3b6ecd5

Please sign in to comment.