androidflutterdartnewrelic

Cannot integrate new relic with Flutter Project


I'm trying to integrate my Flutter project with New Relic for Application Monitoring but when I try to build the project for Android platform, I get this error:

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Projects\Flutter Projects\easy_invest_app\android\build.gradle' line: 29

* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
   > groovy.lang.MissingPropertyException: Could not get unknown property 'sources' for object of type com.android.build.api.component.analytics.AnalyticsEnabledApplicationVariant.

this is my 'android/build.gradle' file:

buildscript {
    ext.kotlin_version = '1.7.20'
    repositories {
        google()
        mavenLocal()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.1.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.13'
        classpath "com.newrelic.agent.android:agent-gradle-plugin:7.1.0"
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

tasks.register("clean", Delete) {
    delete rootProject.buildDir
}

Min SDK Version is 24 and I added everything that this guide says But still, the error occurs. how can I solve this problem?

I expect to integrate the new relic with my android project output.


Solution

  • The supported version of Gradle and NewRelic pair is in provided in The Documention

    Upgrade Gradle:-

     classpath 'com.android.tools.build:gradle:8.1.2'
    

    or downgrade newrelic :-

    classpath "com.newrelic.agent.android:agent-gradle-plugin:6.2.0"