Skip to content

Build failed with an exception. * Where: Build file line: 35 * What went wrong: A problem occurred evaluating root project 'android'. > Could not find method implementation() for arguments [com.android.support:support-annotations:28.0.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. #2494

Closed
@sunilcoder36

Description

@sunilcoder36

**ERROR EXCEPTION:**
Launching lib\main.dart on  in debug mode...
Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

* Where:
Build file 'G:\programs\flutterproject\post\android\build.gradle' line: 35

* What went wrong:
A problem occurred evaluating root project 'android'.
> Could not find method implementation() for arguments [com.android.support:support-annotations:28.0.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --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 1m 22s
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin cloud_firestore...
Running Gradle task 'assembleAarRelease'...
Finished with error: The plugin cloud_firestore could not be built due to the issue above.

**Project level build.gradle :**
buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
        google()
            jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.3'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.3'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

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

task clean(type: Delete) {
    delete rootProject.buildDir
}

dependencies {
    implementation 'com.android.support:support-annotations:28.0.0'
    implementation 'androidx.annotation:annotation:1.1.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.android.support:support-v13:28.0.0'
    implementation 'com.android.support:appcompat-v7:28.0.0'

}

**app level build.gradle file:**
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 28

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        minSdkVersion 21
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation 'com.android.support:customtabs:28.0.0'
    implementation 'com.android.support:support-media-compat:28.0.0'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'com.google.firebase:firebase-analytics:17.4.0'
}
apply plugin: 'com.google.gms.google-services'

gradle.properties file:

org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true

EXPECTED Behavior
Project should build and run successfully

I tried all previous solution but nothing worked for me.
Please help to solve this issue is not same I searched
Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    blocked: customer-responseWaiting for customer response, e.g. more information was requested.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions