I am attempting to deploy a React Native Android application using CircleCI.
Here is the job
android_deploy_staging:
docker:
- image: cimg/android:2021.12.2-node
environment:
JAVA_OPTS: '-Xms512m -Xmx2g'
GRADLE_OPTS: '-Xmx3g -Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-Xmx2g -XX:+HeapDumpOnOutOfMemoryError"'
steps:
- checkout
- *fetchDeployKeys
- run: git config --global url."https://qadrebot:$GITHUB_TOKEN@github.com".insteadOf "https://github.com"
- run: *set_node_version
- restore_cache: *restore_npm_cache
- run: *install_npm_dependencies
- save_cache: *save_npm_cache
- restore_cache:
key: 4-gems-{{ checksum "android/Gemfile.lock" }}
- run: cd android; bundle check || bundle install --path vendor/bundle --clean
- save_cache:
key: 4-gems-{{ checksum "android/Gemfile.lock" }}
paths:
- vendor/bundle
- run:
name: Install Fastlane
command: sudo gem install fastlane
- run:
name: bundle install
command: cd android && bundle install
- run:
environment:
ANDROID_SDK_ROOT: '/home/circleci/android-sdk'
name: Prepare environment and compile beta
no_output_timeout: 30m
command: |
echo Executing fastlane
yarn deploy_staging:android
However I get an error about the SDK location not being found.
[12:36:31]: -------------------
[12:36:31]: --- Step: clean ---
[12:36:31]: -------------------
[12:36:31]: $ /home/circleci/project/android/gradlew clean -p .
[12:36:31]: ▸ Downloading https://services.gradle.org/distributions/gradle-6.4-all.zip
[12:36:32]: ▸ .............10%..............20%..............30%..............40%..............50%..............60%..............70%..............80%..............90%.............100%
[12:36:34]: ▸ Welcome to Gradle 6.4!
[12:36:34]: ▸ Here are the highlights of this release:
[12:36:34]: ▸ - Support for building, testing and running Java Modules
[12:36:34]: ▸ - Precompiled script plugins for Groovy DSL
[12:36:34]: ▸ - Single dependency lock file per project
[12:36:34]: ▸ For more details see https://docs.gradle.org/6.4/release-notes.html
[12:36:35]: ▸ Starting a Gradle Daemon (subsequent builds will be faster)
[12:36:49]: ▸ > Configure project :app
[12:36:49]: ▸ Reading env from: ./app/services/config/.env.staging
[12:36:49]: ▸ WARNING: DSL element 'DexOptions.incremental' is obsolete.
[12:36:49]: ▸ It will be removed in version 5.0 of the Android Gradle plugin.
[12:36:49]: ▸ WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
[12:36:49]: ▸ It will be removed in version 5.0 of the Android Gradle plugin.
[12:36:49]: ▸ For more information, see http://d.android.com/r/tools/update-dependency-configurations.html.
[12:36:51]: ▸ FAILURE: Build failed with an exception.
[12:36:51]: ▸ * What went wrong:
[12:36:51]: ▸ A problem occurred configuring project ':app'.
[12:36:51]: ▸ > Could not create task ':app:lintDebug'.
[12:36:51]: ▸ > SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/home/circleci/project/android/local.properties'.
[12:36:51]: ▸ * Try:
[12:36:51]: ▸ Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
[12:36:51]: ▸ * Get more help at https://help.gradle.org
[12:36:51]: ▸ BUILD FAILED in 20s
On the CircleCi website it states
This image contains the Android SDK and CLI tools.
But it looks like maybe the Android SDK isn’t installed?
Has anyone come across this before?