Execution failed for task ‘:app:sonar’ for Android CI projects

Hi, so last year I already opened a question about this topic: Execution failed for task ':app:sonar'

This time I followed these steps again:

  • Created an organization on GitHub
  • Created repository
  • Created a Kotlin Android project (Empty Views Activity) using API 30 (min), API 36 (target) and Kotlin DSL
  • Imported organization into SonarCloud
  • Added repository for analysis
  • Selected free plan
  • Disabled automatic analysis
  • Added Sonar Token
  • Use GitHub CI as analysis method
  • Added build.yml and updated build.gradle.kts
  • Added execution permissions to gradlew

Since AGP 9.3.x is not properly supported by SonarCloud yet, i used AGP 8.13.2. (with Gradle 8.13). I am also using the latest version of SonarCloud (7.2.3.7755). The build.yml workflow is generated by SonarCloud and has not been modified.

However, when my CI runs the workflow, it fails with the same error as last year (see logs below). At that time I was advised to use the outdated version 5.1.0.4882, which still works fine. Since two newer versions have been released since then, I would like to ask whether this issue still persists for Android CI projects, or if I might be missing something in my setup.

My build.gradle:

plugins {
    alias(libs.plugins.android.application)
    id("org.sonarqube") version "7.2.3.7755"
}

android {
    namespace = "at.testing"
    compileSdk {
        version = release(36) {
            minorApiLevel = 1
        }
    }

    defaultConfig {
        applicationId = "at.testing"
        minSdk = 29
        targetSdk = 36
        versionCode = 1
        versionName = "1.0"

        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            isMinifyEnabled = false
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
        }
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_11
        targetCompatibility = JavaVersion.VERSION_11
    }
}

sonar {
    properties {
        property("sonar.projectKey", "SE-II-group-new_testing-app-2")
        property("sonar.organization", "se-ii-group-new")
    }
}

dependencies {
    implementation(libs.androidx.core.ktx)
    implementation(libs.androidx.appcompat)
    implementation(libs.material)
    testImplementation(libs.junit)
    androidTestImplementation(libs.androidx.junit)
    androidTestImplementation(libs.androidx.espresso.core)
}

The error log:

Resolved properties for :app and wrote them to /home/runner/work/testing-app-2/testing-app-2/app/build/sonar-resolver/properties.
Resolve mutations for :app:sonar (Thread[#86,Execution worker Thread 2,5,main]) started.
:app:sonar (Thread[#86,Execution worker Thread 2,5,main]) started.

> Task :app:lintVitalAnalyzeRelease
Android Lint: Creating lint class loader 31.13.2_false

> Task :app:sonar FAILED
No variant name specified to be used by SonarQube. Default to 'debug'
Caching disabled for task ':app:sonar' because:
  Build cache is disabled
  Caching has not been enabled for the task
Task ':app:sonar' is not up-to-date because:
  Task.upToDateWhen is false.
org.sonarqube Gradle plugin 7.2.3.7755
Java 21.0.10 Eclipse Adoptium (64-bit)
Linux 6.14.0-1017-azure (amd64)
About to look at resolver files: [/home/runner/work/testing-app-2/testing-app-2/app/build/sonar-resolver/properties]
Looking at file: /home/runner/work/testing-app-2/testing-app-2/app/build/sonar-resolver/properties
No variant name specified to be used by SonarQube. Default to 'debug'
Communicating with SonarQube Cloud
JRE provisioning: os[linux], arch[x86_64]

> Task :app:lintAnalyzeDebug
Caching disabled for task ':app:lintAnalyzeDebug' because:
  Build cache is disabled
Task ':app:lintAnalyzeDebug' is not up-to-date because:
  No history is available.
Android Lint: Reusing lint classloader 31.13.2_false

> Task :app:lintAnalyzeDebugAndroidTest
Caching disabled for task ':app:lintAnalyzeDebugAndroidTest' because:
  Build cache is disabled
Task ':app:lintAnalyzeDebugAndroidTest' is not up-to-date because:
  No history is available.
Android Lint: Reusing lint classloader 31.13.2_false
AAPT2 aapt2-8.13.2-14304508-linux Daemon #0: shutdown

AAPT2 aapt2-8.13.2-14304508-linux Daemon #1: shutdown
FAILURE: Build failed with an exception.
Android Lint: Disposing Uast application environment in lint classloader [31.13.2_false]

* What went wrong:
Execution failed for task ':app:sonar'.
> 'org.apache.commons.compress.archivers.tar.TarArchiveEntry org.apache.commons.compress.archivers.tar.TarArchiveInputStream.getNextEntry()'

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 2m 15s
85 actionable tasks: 85 executed
Error: Process completed with exit code 1.

My dependencies:

[versions]
agp = "8.13.2"
coreKtx = "1.18.0"
junit = "4.13.2"
junitVersion = "1.3.0"
espressoCore = "3.7.0"
appcompat = "1.7.1"
material = "1.13.0"

[libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }

[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }

GitHub Repository: GitHub - SE-II-group-new/testing-app-2 · GitHub
Action with latest SonarCloud version: fix · SE-II-group-new/testing-app-2@5a373c5 · GitHub
Action with outdated SonarCloud version: fix · SE-II-group-new/testing-app-2@aaddeee · GitHub

Hi,

Properly supporting Android is on the list, but we haven’t been able to get to it yet. Check back in April, please.

 
Thx,
Ann

1 Like