Problem
I have an Android project that compiles and works correctly. It was “managed” by Gradle and was continuously built with Jenkins. I would like to analyze the quality of my code using Sonar.
Sonar analysis is performed using the sonarRunner Gradle task. The problem is that Sonar is still telling me that there is a "0 question" ... (I can make sure there are errors ... I add one to be sure ...). However, it gives me other information, such as: the number of lines of code, the number of classes, the number of comments and the number of documents, the percentage of duplication, complexity ... It looks like Android Lint is not working.
What i tried
lint works like a charm ...:
Ran lint on armRelease variant: 153 numbers found
Ran lint on armDebug variant: 153 numbers found
Ran lint on x86Debug: 153 issues found
Ran lint on variant x86Release: 153 issues found
I tried a lot of things that I read over the Internet and SO:
I had some other errors, such as "Class" android / content / res / Resources "is not available through ClassLoader". or something else, but I could never get the right report).
Details
Project structure
- myProjectName | build | libs | src | debug | main | assets | java | com.myPackage... | jniLibs | res | AndroidManifest.xml | release | build.gradle | gradle.properties | settings.gradle
settings.gradle
Empty
gradle.properties
Empty
build.gradle (unnecessary parts removed)
buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:0.12.2' } } /********************************** * Plugins declarations **********************************/ apply plugin: 'com.android.application' apply plugin: "sonar-runner" /********************************** * Sonar Runner configuration **********************************/ sonarRunner { sonarProperties { property "sonar.host.url", "http://pic.url/sonar" property "sonar.jdbc.url", "jdbc:mysql://pic.url/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true" property "sonar.jdbc.driverClassName", "com.mysql.jdbc.Driver" property "sonar.jdbc.username", "*****" property "sonar.jdbc.password", "*****" property "sonar.language", "java" property "sonar.profile", "MyCompany Android" property "sonar.projectVersion", "1.0" property "sonar.analysis.mode", "analysis" properties["sonar.sources"] = android.sourceSets.main.java.srcDirs properties["sonar.binaries"] = [file("build/intermediates/classes/x86/debug")] } } /********************************** * Android configuration **********************************/ android { compileSdkVersion 20 buildToolsVersion "20.0.0" defaultConfig { applicationId "com.myPackage..." minSdkVersion 14 targetSdkVersion 16 versionCode 1 versionName "1.0" } lintOptions { abortOnError false } }
As I tried a lot of things, I do not know what to try next. Please ask in the comments if you need more information.
Last information:
- Sonar 3.7
- Gradle 1.12
- JVM 1.8.0_20 Oracle
- OS: Linux Fedora 20
EDIT
gradle sonarRunner log (asked in the comments): http://pastebin.com/uJwqpAkY
(all "***" is here to hide company names, everything is fine :))