The SonarQube Prepare Analysis Configuration must be added

Hi All,

I configured azure pipeline for sonarqube when ever there is a push to the branch the pipeline is running.But I am getting the following issue

The SonarQube Prepare Analysis Configuration must be added.

Here is my .yml file.

**# Gradle**
**# Build your Java project and run tests with Gradle using a Gradle wrapper script.**
**# Add steps that analyze code, save build artifacts, deploy, and more:**
**# https://docs.microsoft.com/azure/devops/pipelines/languages/java**

**trigger:**
**- dev**

**steps:**
**- task: SonarQubePublish@5**
**  inputs:**
**    pollingTimeoutSec: '300'**


**- task: Gradle@3**
**  inputs:**
**    gradleWrapperFile: 'gradlew'**
**    tasks: 'build'**
**    publishJUnitResults: true**
**    testResultsFiles: '**/TEST-*.xml'**
**    javaHomeOption: 'JDKVersion'**
**    jdkVersionOption: '1.11'**
**    sonarQubeRunAnalysis: true**
**    sqGradlePluginVersionChoice: 'build'**
**    checkStyleRunAnalysis: true**
**    findBugsRunAnalysis: true**
**    spotBugsAnalysis: true**
**    spotBugsGradlePluginVersionChoice: 'build'**
**- task: SonarQubePrepare@5**
**  inputs:**
**    SonarQube: 'xxxxxxx'**
**    scannerMode: 'Other'**
**    extraProperties: |**
**      # Additional properties that will be passed to the scanner, **
**      # Put one key=value per line, example:**
**      # sonar.exclusions=**/*.bin**
**      sonar.verbose=true**
**      sonar.projectKey=xxxxxx.android**

Hey there.

The SonarQubePrepare@5 needs to come before the Gradle@3 task, not after.

after changing this i am getting another error.

[SQ] API GET ‘/api/server/version’ failed, error was: {“errno”:“EAI_AGAIN”,“code”:“EAI_AGAIN”,“syscall”:“getaddrinfo”,“hostname”:“XXXX”,“host”:“XXXX”,“port”:“9000”}

It looks like there’s more generally an issue between the Azure DevOps build agent and your SonarQube server. Is your SonarQube server accessible from the build agent?