October 23, 2024
Chicago 12, Melborne City, USA
Android

Flutter app crashing on launch and stuck on gradelBuild


This has never happened in any of my previous flutter projects, but when i try and run my app in an emulator, the app pops up and then crashes without any error message and continues building the app without anything happening.

I did some tests and noticed that it starts happening when I add the "buildscript{}" in the build.gradle file in the android directory:

buildscript { ext.kotlin_version = '1.9.0' repositories { google() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:8.1.2' // START: FlutterFire Configuration classpath 'com.google.gms:google-services:4.4.2' // Required for Firebase // END: FlutterFire Configuration classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } 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 }

Sometimes I get an error saying that the kotlin version doens’t match the binary version.

I have the latest version of flutter and have already tried "flutter pub upgrade", "flutter clean", all of that.

This is my flutter doctor:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.24.3, on Microsoft Windows
    [Version 10.0.22631.4317], locale pt-PT)
[√] Windows Version (Installed version of Windows is version 10
    or higher)
[!] Android toolchain - develop for Android devices (Android SDK
    version 32.1.0-rc1)
    X cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"` 
      See https://developer.android.com/studio/command-line for 
      more details.
    X Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK 
      licenses.
      See https://flutter.dev/to/windows-android-setup for more 
      details.
[√] Chrome - develop for the web
[!] Visual Studio - develop Windows apps (Visual Studio
    Community 2022 17.8.3)
    X Visual Studio is missing necessary components. Please     
      re-run the Visual Studio installer for the "Desktop       
      development with C++" workload, and include these
      components:
        MSVC v142 - VS 2019 C++ x64/x86 build tools
         - If there are multiple build tool versions available, 
         install the latest
        C++ CMake tools for Windows
        Windows 10 SDK
[!] Android Studio (not installed)
[√] IntelliJ IDEA Ultimate Edition (version 2023.2)
[√] VS Code (version 1.94.2)
[√] Connected device (4 available)
[√] Network resources



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video