--

Monday, 27 August 2018

Part 2 - Centralized Sonar Analysis - SonarCloud Android integration


Please refer Part 1 - Monitoring code quality of your Android application with SonarQube for better understanding,
https://akcjayaprakash.blogspot.com/2018/07/monitoring-code-quality-of-your-android.html

Instead of local Sonar, we are creating the project in “https://sonarcloud.io/” by clicking + icon at the top right corner.



Enter ‘Project name’ & ‘Project key’ then click ‘Create’. We must use the same given Project name & Project key in sonarqube.gradle

There is no change for adding Sonarqube plugin to the project & app level Gradle files. We should update the proper SonarCloud configuration in sonarqube.gradle

property "sonar.host.url", "https://sonarcloud.io"
property "sonar.projectKey", "Same project key from the SonarCloud project"
property "sonar.organization", "organization key from SonarCloud"
property "sonar.login", "Unique token created by SonarCloud"
property "sonar.projectName", "Same project name from the SonarCloud project"


Use remaining properties of the sonarqube.gradle from Local sonar implementation.


After building or syncing project, open a Command Prompt and navigate to the app module directory of your project where your Gradle file is located.

Execute gradlew sonarqube and wait until the build is completed. Here we go,



The Android project for Centralized Sonar Analysis is pushed to SonarCloud. The measures of Android project contains code smell, lines of code, issues, and etc.






Please feel free to post any queries,doubts or suggestions in the comments section.