Could not find method debugProvided() for arguments [file collection] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler


(Mahi K) #1

Hello there,

I am using the flutter framework and started seeing this error only in one of the apps.

Script ‘C:\Users\username\flutter\packages\flutter_tools\gradle\flutter.gradle’ line: 168

* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
   > Could not resolve all dependencies for configuration ':app:_debugApk'.
      > A problem occurred configuring project ':firebase_storage'.
         > Could not find method debugProvided() for arguments [file collection] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

My gradle file looks like this.

    buildscript {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
        classpath 'com.google.gms:google-services:3.1.1'
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}

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

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

and my android/app/gradle file looks like this:

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
 if (localPropertiesFile.exists()) {
localPropertiesFile.withInputStream { stream ->
    localProperties.load(stream)
    }
  }

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

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

        android {
          compileSdkVersion 25
           buildToolsVersion '25.0.3'

      lintOptions {
        disable 'InvalidPackage'
         }

      defaultConfig {
     // TODO: Specify your own unique Application ID 
    (https://developer.android.com/studio/build/application-id.html).
    applicationId "com.prayuta.sharemyticket"
    minSdkVersion 16
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
    testInstrumentationRunner "android.support.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
     }
       debug{
        applicationIdSuffix ".dev"
       }
    }
   }

    flutter {
     source '../..'
   }

       dependencies {
        androidTestCompile 'com.android.support:support-annotations:25.4.0'
       androidTestCompile 'com.android.support.test:runner:0.5'
       androidTestCompile 'com.android.support.test:rules:0.5'
      }
     apply plugin: 'com.google.gms.google-services'

Please can someone tell me what might have gone wrong and a possible solution for this.

Many Thanks,
Mahi