SonarQube, formerly known as Sonar, is a platform to analyze code quality.

Installing SonarQube

  1. Go to and download the latest release.
  2. Unzip the archive to the directory of your choice.

Starting SonarQube

  1. Go to your downloaded SonarQube.
  2. Open bin/[folder corresponding to your OS]
  3. Open up a terminal window and navigate to bin/[folder corresponding to your OS]
  4. Now you need to execute the correspoding file in the terminal.
  5. For eg: On Mac : sh start (or just double click StartSonar.bat on windows).
    This command will start sonar listening on localhost:9000.

  6. Open a browser and enter localhost:9000. The sonar Dashboard should open.
    It may take some time to Load.

Analyse Your Android Studio Project

Open Your Project’s build.gradle and add like this.

buildscript {
    repositories {
        maven {
            url ""
    dependencies {
        classpath ''
        classpath "org.sonarqube.gradle:gradle-sonarqube-plugin:1.0"

Now open the module’s build.gradle you want to analyse and add the below script.

apply plugin: "org.sonarqube"

sonarqube {
    properties {
        property "sonar.projectName", "MySampleProject"
        property "sonar.projectKey", "MySampleProject"
        property "", "http://localhost:9000"
        property "sonar.projectVersion", "1.0"
        property "sonar.language", "java"
        property "sonar.sources", "src/main/"

Open your terminal in the Android Studio and execute the below command.

    $ : ./gradlew sonar

You can see a series of output in the terminal and at the end You can see where the report is generated…something like this


All Done.

Please send your feedback to


Leave a Reply

Your email address will not be published. Required fields are marked *




Theme by HermesThemes

Copyright © 2018 CoderzHeaven. All Rights Reserved

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.