title: Flutter : can't build android in debug or release
body: <p>suddenly my app can't run in debug or release mode.
  i have added some screens in the ui but i didn't change or add any packages.
  i don't know what happened exactly, but i have tried to reverse my changes with local history in Android Studio, but nothing happened too.</p>
  <p>my output is :</p>
  <pre><code>    FAILURE: Build completed with 2 failures.
  
       1: Task failed with an exception.
       -----------
       * Where:
       Build file '/Users/mackbookpro/.pub- 
       cache/hosted/pub.dartlang.org/flutter_mapbox_navigation-0.0.24/android/build.gradle' 
       line: 31
  
     * What went wrong:
  A problem occurred evaluating project ':flutter_mapbox_navigation'.
  &gt; Basedir /Users/mackbookpro/.pub-cache/hosted/pub.dartlang.org/cloud_firestore_web-0.2.1+2/android does not exist
  
  * 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.
  ==============================================================================
  
  2: Task failed with an exception.
  -----------
  * Where:
  Script '/Users/mackbookpro/Desktop/development/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 346
  
  * What went wrong:
  A problem occurred configuring project ':flutter_mapbox_navigation'.
  &gt; Could not get unknown property 'android' for project ':flutter_mapbox_navigation' of type org.gradle.api.Project.
  
  * 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 4s
  Exception: Gradle task assembleDebug failed with exit code 1
  </code></pre>
  <p>Flutter doctor log:</p>
  <pre><code>[✓] Flutter (Channel beta, 2.2.0, on Mac OS X 10.15.7 19H111 darwin-x64, locale en-EG)
      • Flutter version 2.2.0 at /Users/mackbookpro/Desktop/development/flutter
      • Framework revision b22742018b (4 weeks ago), 2021-05-14 19:12:57 -0700
      • Engine revision a9d88a4d18
      • Dart version 2.13.0
  
  [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
      • Android SDK at /Users/mackbookpro/Library/Android/sdk
      • Platform android-30, build-tools 30.0.3
      • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
      • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
      • All Android licenses accepted.
  
  [✓] Xcode - develop for iOS and macOS
      • Xcode at /Applications/Xcode.app/Contents/Developer
      • Xcode 12.4, Build version 12D4e
      • CocoaPods version 1.10.1
  
  [✓] Chrome - develop for the web
      • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
  
  [✓] Android Studio (version 4.1)
      • 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 1.8.0_242-release-1644-b3-6915495)
  
  [✓] VS Code (version 1.56.2)
      • VS Code at /Applications/Visual Studio Code.app/Contents
      • Flutter extension can be installed from:
         https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
  
  [✓] Connected device (2 available)
      • Infinix X650D (mobile) • 05254259CA004636 • android-arm64  • Android 9 (API 28)
      • Chrome (web)           • chrome           • web-javascript • Google Chrome 91.0.4472.77
  
  • No issues found!
  Process finished with exit code 0
  </code></pre>
  <p>i've tried to delete .gradle file and nothing happened.</p>
  <p>EDITED.
  my pubsec.yaml :</p>
  <pre><code>name: app
  description: Application
  
  # The following line prevents the package from being accidentally published to
  # pub.dev using `pub publish`. This is preferred for private packages.
  publish_to: 'none' # Remove this line if you wish to publish to pub.dev
  
  # The following defines the version and build number for your application.
  # A version number is three numbers separated by dots, like 1.2.43
  # followed by an optional build number separated by a +.
  # Both the version and the builder number may be overridden in flutter
  # build by specifying --build-name and --build-number, respectively.
  # In Android, build-name is used as versionName while build-number used as versionCode.
  # Read more about Android versioning at https://developer.android.com/studio/publish/versioning
  # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
  # Read more about iOS versioning at
  # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
  version: 2.0.8+28
  
  environment:
    sdk: &quot;&gt;=2.11.0 &lt;3.0.0&quot;
  
  dependencies:
    flutter:
      sdk: flutter
  
    # The following adds the Cupertino Icons font to your application.
    # Use with the CupertinoIcons class for iOS style icons.
    cupertino_icons: ^1.0.0
  
    #Checkboxes Library
    grouped_buttons: ^1.0.4
  
    #Google Maps Library.
    google_maps_flutter: ^0.5.28+1
  
    #Flutter Map Picker
    google_map_location_picker: ^3.3.3
  
    #Flutter GeoLocator
    geolocator: 5.3.2+2
  
    #Flutter Permissions
    permission: ^0.1.7
  
    #Flutter Lottie Animations
    lottie: ^0.7.0+1
  
    #Flutter Numeric Keyboard
    numeric_keyboard: ^1.0.0
  
    #Flutter Curved Navigation Drawer
    curved_navigation_bar: ^0.3.3
  
    #Flutter Drop Down Field
    dropdownfield: ^1.0.3
  
    #Flutter BLOC
    flutter_bloc: ^6.0.1
  
    #Flutter EQUATABLE
    equatable: ^1.0.2
  
    #Flutter DIO
    dio: ^3.0.9
  
    #Json Serialization
    json_annotation: ^3.0.1
  
    #Flutter Validator
    validators: ^2.0.0+1
  
    #Flutter SharedPrefs
    shared_preferences: ^0.5.8
  
    #Flutter Poly Lines
    flutter_polyline_points: ^0.2.2
  
    #FLutter Location Library
    location: ^3.2.4
  
    #Flutter Map PolyLine
    google_map_polyline:
  
    #Flutter Google Fonts
    google_fonts: ^1.1.0
  
    #Flutter Progress Dialog
    progress_dialog: ^1.2.4
  
    #Flutter Toast
    toast: ^0.1.5
  
    #rxDart
    rxdart: ^0.25.0
  
    #GET NAVIGATOR
    get: ^3.5.1
  
  
    #FLUTTER SLIDING CARD
    sliding_card: ^0.1.2
  
  
    #FLUTTER PERMISSIONS HANDLER
    permission_handler: ^5.0.1+1
  
    #FLUTTER BUTTON SLIDER
    slider_button: ^0.6.0
  
    #FLUTTER RADIO GROUP
    group_radio_button: ^1.0.1
  
    #FLUTTER MATERIAL COLOR
    material_design_icons_flutter: ^4.0.5855
  
    #FLUTTER DROPDOWN FIELD
    dropdown_formfield: ^0.1.3
  
    #FLUTTER TOGGLE SWITCH
    toggle_switch: ^0.1.8
  
    #FUTTER CHAT
    flutter_chat: ^1.1.0
  
    #FLUTTER SLIDE BUTTON
    slide_button: ^0.2.8
  
    #FLUTTER MAPBOX NAVIGATION
    flutter_mapbox_navigation: ^0.0.19
  
    #FLUTTER URI LAUNCHER
    url_launcher: ^6.0.2
  
    #FLUTTER SOUNDS
    audioplayers: ^0.17.4
  
    #FLUTTER ALARM MANAGER
  #  android_alarm_manager: ^2.0.0
  
    #FLUTTER SIMPLE BAR RATING
    flutter_simple_rating_bar: 0.0.3
  
    #FLUTTER SUNRISE SUNSET
    sunrise_sunset: ^1.0.4
  
    #FLUTTER ICON LAUNCHER
    flutter_launcher_icons: ^0.8.1
  
    #FLUTTER ANIMATED SPLASH SCREEN
    animated_splash_screen: ^1.0.1+2
  
    #FLUTTER ANIMATE DO
    animate_do: ^1.7.5
  
    #FLUTTER COUNTRY PICKER
    country_code_picker: ^1.7.0
  
    #FLUTTER DELAYED ANIMATION
    delayed_display: ^1.1.0
  
    #FLUTTER CAROUSEL SLIDER
    carousel_slider: ^3.0.0
  
    #FLUTTER CACHED NETWORK IMAGE
    cached_network_image: ^2.5.0
  
    #FLUTTER SETTINGS UI
    settings_ui: ^0.6.0
  
    #FLUTTER VECTOR ICONS
    flutter_vector_icons: ^0.3.0
  
    #FLUTTER EXTENDED NAVBAR SCAFFOLD
    extended_navbar_scaffold:
  
    #FLUTTER CUSTOM SWITCH
    custom_switch: ^0.0.1
  
    #FLUTTER WAKELOCK
    wakelock: ^0.5.2
  
    #FLUTTER HTTP
    http: ^0.12.2
  
    #FLUTTER LOCALIZATIONS
    flutter_localizations:
      sdk: flutter
  
    #FLUTTER MULTIPLE IMAGE PICKER
    multi_image_picker: ^4.7.14
  
    #FLUTTER LOCAL NOTIFICATIONS
    flutter_local_notifications: ^4.0.1+1
  
    #FLUTTER GOOGLE PLACES
    flutter_google_places: ^0.2.6
  
    #FLUTTER DROPDOWN SEARCH
    dropdown_search: ^0.4.8
  
    #FLUTTER FIREBASE MESSAGING
    firebase_messaging: ^7.0.3
  
    #FLUTTER OVERLAY SUPPORT
    overlay_support: ^1.0.5
  
    #FLUTTER ANDROID INTENT
    android_intent: ^0.3.7+7
  
    #FLUTTER ROUNDED BUTTON
    rounded_loading_button: ^1.0.18
  
    #FLUTTER ZOOM MENU DRAWER
    flutter_zoom_drawer: ^1.0.4+1
  
    #FLUTTER FLOATING ACTION BUTTON CIRCULAR MENU
    fab_circular_menu: ^1.0.1
  
    #FLUTTER MENU
    floating_action_bubble: ^1.1.2
  
    #FLUTTER CHAT BUBBLES
    flutter_chat_bubble: ^1.0.2
  
    #FLUTTER PIN CODE FIELDS
    pin_code_fields: ^6.1.0
  
    #FLUTTER PIP
    flutter_android_pip: ^0.0.2
  
  #  #FLUTTER SOME BS PIP
  #  flutter_ajanuw_android_pip: ^0.1.2
  
    #FLUTTER SLIDE COUNTDOWN CLOCK
    slide_countdown_clock: ^1.0.3
  
    #FLUTTER MAP TOOLKIT
    maps_toolkit: ^1.1.0+2
  
    #FLUTTER TEST SOCKET IO
    socket_io_client: ^0.9.12
  
    #FLUTTER ALI SOCKING HAIRY DICK
    flutter_socket_io: ^0.6.0
  
    #FLUTTER KEYBOARD ATTACHABLE
    keyboard_attachable: ^2.0.0
  
    #FLUTTER KEYBOARD VISIBILITY
    #flutter_keyboard_visibility: ^4.0.4
  
    #FLUTTER SIMPLE DI
    flutter_simple_dependency_injection: ^1.0.4
  
    #FLUTTER AFTER LAYOUT
    after_layout: ^1.1.0
  
  
    #FLUTTER TOGGLE SWITCH
    flutter_switch: ^0.3.1
  
    #FLUTTER PERCENT INDICATOR
    percent_indicator: ^3.0.1
  
  
  
  #  dependency_overrides:
  #  intl: ^0.16.1
  #  path: 1.7.0
  
  
  #  #FLUTTER VOXIMPLANT
  #  flutter_voximplant: 2.5.0
  #
  #  #FLUTTER CALL KIT VOXIMPLANT
  #  flutter_callkit_voximplant: 1.1.0+3
  #
  #  #FLUTTER VOIP PUSH NOTIFICATION
  #  flutter_voip_push_notification: 0.0.3
  
  
  
  
  flutter_icons:
    image_path_android: &quot;assets/captain_logo.png&quot;
    image_path_ios: &quot;assets/captain_logo.png&quot;
    android: true # can specify file name here e.g. &quot;ic_launcher&quot;
    ios: true
  
  dev_dependencies:
    flutter_test:
      sdk: flutter
  
  dependency_overrides:
    intl: ^0.17.0
    location_platform_interface: 1.1.0
    plugin_platform_interface: ^1.0.2
  
  # For information on the generic Dart part of this file, see the
  # following page: https://dart.dev/tools/pub/pubspec
  
  # The following section is specific to Flutter.
  flutter:
  
    # The following line ensures that the Material Icons font is
    # included with your application, so that you can use the icons in
    # the material Icons class.
    uses-material-design: true
  
    # To add assets to your application, add an assets section, like this:
    assets:
     - assets/main_icon.png
     - assets/banned_image.jpg
     - assets/ic_approve_waiting.json
     - assets/loading_anime.json
     - assets/credit_card_animation.json
     - assets/blue_red_heart.json
     - assets/app_new_logo.png
     - assets/ic_car.png
     - assets/map_style.txt
     - assets/ic_user_marker.png
     - assets/captain_logo.png
     - assets/otp_vector_image.jpg
     - assets/new_captain_logo.png
     - assets/new_trip_ringtone.mp3
     - assets/splash_logo.png
     - lib/lang/en.json
     - lib/lang/ar.json
     - assets/new_order.mp3
  
  
    # An image asset can refer to one or more resolution-specific &quot;variants&quot;, see
    # https://flutter.dev/assets-and-images/#resolution-aware.
  
    # For details regarding adding assets from package dependencies, see
    # https://flutter.dev/assets-and-images/#from-packages
  
    # To add custom fonts to your application, add a fonts section here,
    # in this &quot;flutter&quot; section. Each entry in this list should have a
    # &quot;family&quot; key with the font family name, and a &quot;fonts&quot; key with a
    # list giving the asset and other descriptors for the font. For
    # example:
    # fonts:
    #   - family: Schyler
    #     fonts:
    #       - asset: fonts/Schyler-Regular.ttf
    #       - asset: fonts/Schyler-Italic.ttf
    #         style: italic
    #   - family: Trajan Pro
    #     fonts:
    #       - asset: fonts/TrajanPro.ttf
    #       - asset: fonts/TrajanPro_Bold.ttf
    #         weight: 700
    #
    # For details regarding fonts from package dependencies,
    # see https://flutter.dev/custom-fonts/#from-packages
  </code></pre>
  <p>build.gradle(app):</p>
  <pre><code>def localProperties = new Properties()
  def localPropertiesFile = rootProject.file('local.properties')
  if (localPropertiesFile.exists()) {
      localPropertiesFile.withReader('UTF-8') { reader -&gt;
          localProperties.load(reader)
      }
  }
  
  def flutterRoot = localProperties.getProperty('flutter.sdk')
  if (flutterRoot == null) {
      throw new GradleException(&quot;Flutter SDK not found. Define location with flutter.sdk in the local.properties file.&quot;)
  }
  
  def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
  if (flutterVersionCode == null) {
      flutterVersionCode = '28'
  }
  
  def flutterVersionName = localProperties.getProperty('flutter.versionName')
  if (flutterVersionName == null) {
      flutterVersionName = '2.8'
  }
  
  apply plugin: 'com.android.application'
  apply plugin: 'kotlin-android'
  apply plugin: 'com.google.gms.google-services'
  apply from: &quot;$flutterRoot/packages/flutter_tools/gradle/flutter.gradle&quot;
  
  
  def keystoreProperties = new Properties()
  def keystorePropertiesFile = rootProject.file('key.properties')
  if (keystorePropertiesFile.exists()) {
      keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
  }
  
  android {
      compileSdkVersion 29
  
      sourceSets {
          main.java.srcDirs += 'src/main/kotlin'
      }
  
      lintOptions {
          disable 'InvalidPackage'
      }
      compileOptions {
          sourceCompatibility JavaVersion.VERSION_1_8
          targetCompatibility JavaVersion.VERSION_1_8
      }
      defaultConfig {
          // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
          applicationId &quot;app_id&quot;
          minSdkVersion 23
          multiDexEnabled true
          targetSdkVersion 29
          versionCode flutterVersionCode.toInteger()
          versionName flutterVersionName
      }
      signingConfigs {
          release {
              keyAlias keystoreProperties['keyAlias']
              keyPassword keystoreProperties['keyPassword']
              storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
              storePassword keystoreProperties['storePassword']
          }
      }
      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.release
          }
      }
  }
  
  flutter {
      source '../..'
  }
  
  dependencies {
      implementation &quot;org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version&quot;
      implementation 'com.android.support:multidex:1.0.3'
      implementation 'com.google.firebase:firebase-messaging:21.0.1'
  }
  </code></pre>
  <p>build.gradle(module):</p>
  <pre><code>     buildscript {
        ext.kotlin_version = '1.4.32'
        repositories {
          google()
          jcenter()
      }
  
      dependencies {
          classpath 'com.android.tools.build:gradle:3.5.0'
          classpath &quot;org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version&quot;
          classpath 'com.google.gms:google-services:4.3.4'
  
      }
  }
  
  allprojects {
      repositories {
          google()
          jcenter()
      }
  }
  
  rootProject.buildDir = '../build'
  subprojects {
      project.buildDir = &quot;${rootProject.buildDir}/${project.name}&quot;
  }
  subprojects {
      project.evaluationDependsOn(':app')
  }
  
  task clean(type: Delete) {
      delete rootProject.buildDir
  }
  </code></pre>