Sonarcloud pipeline for mobile app project keeps failing

Template for a good new topic, formatted with Markdown:

  • ALM used: BitBucket
  • CI system used BitBucket Cloud
  • Languages of the repository: Kotlin
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
Please wait while Kotlin/Native compiler 1.8.10 is being installed.
Download https://download.jetbrains.com/kotlin/native/builds/releases/1.8.10/linux-x86_64/kotlin-native-prebuilt-linux-x86_64-1.8.10.tar.gz (180.45 MB)
Download https://download.jetbrains.com/kotlin/native/builds/releases/1.8.10/linux-x86_64/kotlin-native-prebuilt-linux-x86_64-1.8.10.tar.gz finished, took 2 s 332 ms
Unpack Kotlin/Native compiler to /root/.konan/kotlin-native-prebuilt-linux-x86_64-1.8.10
Unpack Kotlin/Native compiler to /root/.konan/kotlin-native-prebuilt-linux-x86_64-1.8.10 finished, took 3 s 415 ms
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':androidApp:compileDebugJavaWithJavac'.
> Could not determine the dependencies of null.
   > SDK location not found. Define a valid SDK location with an ANDROID_HOME environment variable or by setting the sdk.dir path in your project's local properties file at '/opt/atlassian/pipelines/agent/build/local.properties'.

Trying to add a pipeline to my mobile app code to run sonarcloud on it and the pipeline keeps failing. I’ve copied the pipeline code directly from Sonarcloud during setup, but it doesn’t work
The yaml file is as follows

image: openjdk:11

clone:
  depth: full              # SonarCloud scanner needs the full history to assign issues properly

definitions:
  caches:
    sonar: ~/.sonar/cache  # Caching SonarCloud artifacts will speed up your build
  steps:
    - step: &build-test-sonarcloud
        name: Build, test and analyze on SonarCloud
        caches:
          - gradle
          - sonar
        script:
          - ./gradlew build sonarqube
        artifacts:
          - build/libs/**

pipelines:                 # More info here: https://confluence.atlassian.com/bitbucket/configure-bitbucket-pipelines-yml-792298910.html
  branches:
    core:
      - step: *build-test-sonarcloud
  pull-requests:
    '**':
      - step: *build-test-sonarcloud

Hey there.

It seems like this is your issue.

Did you have a working build in Bitbucket Pipelines before trying to add SonarCloud analysis? You probably need a base image more tailored for Android app development (with the Android SDK installed and environment variables configured).