What is causing: The org.gradle.api.plugins.Convention type has been deprecated?

I can’t figure out what is causing this warning

I got no problens in neither clean build, --stacktrace nor --warning-mode all. But when I look in problems-report.html it shows:

settings.gradle

pluginManagement {
    plugins {
        id 'com.android.application' version '8.8.0' apply false // https://maven.google.com/web/index.html?q=applic#com.android.application:com.android.application.gradle.plugin
    }
    repositories {
        google {
            content {
                includeGroupByRegex("com\\.android.*")
                includeGroupByRegex("com\\.google.*")
                includeGroupByRegex("androidx.*")
            }
        }
        mavenCentral()
        gradlePluginPortal()
    }
}

rootProject.name = 'AndroidTest'
include('app')

build.gradle

plugins {
    id 'com.android.application'
}

android {
    namespace = "org.example"
    testNamespace = "org.example"
    compileSdkVersion 35

    buildFeatures {
        viewBinding = true
    }

    defaultConfig {
        applicationId "org.example"
        minSdkVersion 26
        targetSdkVersion 35
        versionCode 1
        versionName "1.0"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    sourceSets {
        main {
            java.srcDirs = ['src/main/java/org/example']
            // res.srcDirs = ["./resources"]
        }
        test {
            java.srcDirs = ['src/test/java/org/example']
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_23
        targetCompatibility JavaVersion.VERSION_23
    }
}

repositories {
    google()
    mavenCentral()
    gradlePluginPortal()
}
//
dependencies {
    // implementation(fileTree(dir: "libs", include: ["*.jar"]))
    implementation 'com.android.support:appcompat-v7:28.0.0' // https://maven.google.com/web/index.html?q=support#com.android.support:appcompat-v7
    testImplementation 'org.testng:testng:7.10.2' // https://mvnrepository.com/artifact/org.testng/testng
}

tasks.withType(Test) {
    useTestNG()
}

What is displayed when you expand the node of that warning?
Can you also share a build --scan URL?

All expanded

And the --scan
https://scans.gradle.com/s/v7v5wvdptcjyg

Are you sure that scan is the one that produced that report?

The problems-report.html is produced as soon as I ctrl+s in VSCode. The scan shared is from the project of this report.

For additional context:

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <application
        android:icon="@mipmap/ic_laucher"
        android:allowBackup="true"
        android:supportsRtl="true">
        <activity android:exported="true" android:name=".App">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

App.java

package org.example;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import android.view.Window;

public class App extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        super.onCreate(savedInstanceState);
        TextView textView = new TextView(this);
        textView.setText(getText(R.string.hello_world));
        setContentView(textView);
    }

    public static void main(String[] args) {
        System.out.println("Hello World!");
    }

    public String getGreeting() {
        return "Hello, World!";
    }
}

AppTest.java

package org.example;

import android.content.Context;

import org.testng.annotations.*;
import static org.testng.Assert.*;

public class AppTest {
    @Test public void appHasAGreeting() {
        App classUnderTest = new App();
        assertNotNull(classUnderTest.getGreeting(), "app should have a greeting");
    }
}

I’m also getting 2 warnings in VS Code “Problems”

App.java is not on the classpath of project app, only syntax errors are reported
AppTest.java is not on the classpath of project app, only syntax errors are reported

My time is too valuable to use a fancy text editor, when I instead can use an awesome IDE :-D, so I cannot tell you anything about VSC stuff or errors it displays, besides that it is anyway out of scope for a Gradle forum.

That the scan is from the same project is irrelevant, the scan must be from the exact invocation that produces what you want to show or it is useless.
You could programmatically enable build scans to also capture runs not under your direct control, but as you say that report is generated if you save in VSC and not otherwise, it looks to me like the VSC Gradle integration is doing bad things that triggers this and you should head to its maintainers instead.

Thank you for your explanation.

I will try to get proper scan from that issue after contact the plugin developers

1 Like