0

ERROR:

Exception: [!] Your app is using an unsupported Gradle project. To fix this problem, create a new project by running `flutter create -t app <app-directory>` and then move the dart code, assets and pubspec.yaml to the new project.

Hi there! I have to update a flutter project from flutter v1 to flutter v3. Before the code and libraries update I need to restart this old project. On ios it works, but on android i get this error. I have this specific gradle version in wrapper properties: distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip; Then this is my build.gradle (under android folder):

buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
        google()
        jcenter()
    }

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

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
}

Then it looks strange that there isn't the build.gradle file under src folder where should be defined the minSdkVersion, targetSdkVersion, plugins etc. This is my flutter doctor output:

[✓] Flutter (Channel beta, 1.24.0-10.2.pre, on macOS 13.3 22E252 darwin-arm, locale it-IT)
    • Flutter version 1.24.0-10.2.pre at /Users/alessandro_cancelliere/fvm/versions/1.24.0-10.2.pre
    • Framework revision 022b333a08 (2 years, 7 months ago), 2020-11-18 11:35:09 -0800
    • Engine revision 07c1eed46b
    • Dart version 2.12.0 (build 2.12.0-29.10.beta)

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/alessandro_cancelliere/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 14.3, Build version 14E222b
    • CocoaPods version 1.12.1

[✓] Android Studio (version 2022.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] IntelliJ IDEA Ultimate Edition (version 2021.1)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.79.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.67.20230601

I have tried a lots of solutions as this post suggests https://stackoverflow.com/questions/62064188/exception-your-app-is-using-an-unsupported-gradle-project and I also tried with different versions of Java, but nothing worked.

xelanac
  • 21
  • 4

1 Answers1

0

What if you just create a project with flutter create -t app <app-directory> and move codebase 'lib' folder to new project. I suppose that is the best way to resolve your issue cause flutter v1 is very different than v3

Jakhongir Anasov
  • 1,207
  • 7
  • 16