0

I am following the Flutter tutorial for installing the Firebase SDK, and VSCode seems to be having a problem with the grade. It is telling me that 'Your app is using an unsupported Gradle project'. I've looked at all of the relevant questions on this website and tried everything I can, but this error doesn't seem to go away. Here are all of the things that I think are relevant: My top-level gradle.build file:

    buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.10.0'
        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
}

My app module 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 GradleException("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: 'com.google.gms.google-services'

android {
    compileSdkVersion 28

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "org.RiverRipple.cibo"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        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
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    testImplementation 'junit:junit:4.12'
    implementation 'com.google.firebase:firebase-analytics:17.2.2'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

My gradle-wrapper.properties file:

#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip

Please tell me where the issue is being created.

Neesh
  • 143
  • 2
  • 3
  • 13

1 Answers1

0

from your errors

Your app is using an unsupported Gradle project'.

you need to update your gradle to latest

dependencies {
    classpath 'com.android.tools.build:gradle:3.5.0'

and

distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
griffins
  • 7,079
  • 4
  • 29
  • 54
  • sorry, this didn't work. It's still showing the same error. – Neesh Jul 04 '20 at 13:09
  • run flutter clean and then run your project – griffins Jul 05 '20 at 14:18
  • No, that didn't work :(. Do you think that I'll just have to create a new project and move all the files? – Neesh Jul 05 '20 at 15:54
  • that would suck... but what error does it give ? if this Your app is using an unsupported Gradle project' then https://stackoverflow.com/questions/23025433/how-to-clear-gradle-cache – griffins Jul 05 '20 at 16:17
  • I tried to do what they said, but my project doesn't have a caches folder... – Neesh Jul 05 '20 at 18:24
  • The folders in my .gradle folder are 4.10.2, buildOutputCleanup, and vcs-1 – Neesh Jul 05 '20 at 18:26
  • if you have android studio try opening the project with it and building – griffins Jul 06 '20 at 01:41
  • It says that it can't resolve the symbol GradleException at line 11 in my applevel gradle file, even though I didn't change anything there – Neesh Jul 06 '20 at 14:28
  • Actually nevermind, the GradleException thing didn't change anything, and it still let me run the app in cmd prompt, but I still got the unsupported gradle error – Neesh Jul 06 '20 at 23:14