How to solve Cannot invoke method afterEvaluate() on null object Flutter android, ios working well

Viewed 63

I'm running an old flutter project using new flutter version.3.0.2, but when im debugging it shows an error like this. It run on ios enter image description here

and i tried

Downgrading flutter version, Updating dependancies/Reparing dependancies

Here is my app/build gradle

 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 = '13'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0.12'
}

apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

def keystorePropertiesFile = rootProject.file('key.properties')
def keystoreProperties = new Properties()
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}


android {
    compileSdkVersion 29

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.irings.elitco"
        minSdkVersion 19
        targetSdkVersion 29
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        multiDexEnabled true
    }

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile keystoreProperties['G:/AAIRINGSMAINAPPS/GITHUB/Elitco/key.jks'] ? file(keystoreProperties['G:/AAIRINGSMAINAPPS/GITHUB/Elitco/key.jks']) : 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 "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.google.firebase:firebase-analytics:17.5.0'
    implementation 'com.android.support:multidex:1.0.3'
    implementation "com.google.firebase:firebase-messaging:20.1.0"
}

project-level build gradle

  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.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
}

and pubspec.yaml

    name: elitco
description: A new Flutter 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: 1.0.29+30

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  badges: ^1.1.0
  http: ^0.12.0+1
  fluttertoast: 3.1.3

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: 0.1.3
  shared_preferences: 0.5.8
  pin_entry_text_field: 0.1.3
  flutter_plugin_pdf_viewer: 1.0.7
  firebase_core: ^0.4.1+3
  firebase_messaging: 6.0.9
  cloud_firestore: 0.12.10
  firebase_auth: 0.14.0+8
  image_picker: ^0.6.7+12
  google_maps_flutter: ^0.5.32
  geolocator: 6.1.14
  geocoder: 0.2.1
  curved_navigation_bar: 0.3.4
  carousel_pro: 0.0.13
  carousel_slider: 2.3.1
  pin_input_text_field: 3.1.1
  imagebutton: 0.0.6
  firebase_dynamic_links: ^0.5.0+11
  share: ^0.6.3+1
  solid_bottom_sheet: 0.1.9
  smooth_star_rating: 1.1.1
  connectivity: ^0.4.3+2
  provider: 2.0.1
  bubble: ^1.1.9+1
  intl: 0.16.1
  image_cropper: 1.3.1
  screenshot: 0.1.1
  esys_flutter_share: 1.0.2
  delayed_display: 1.0.3
  circular_check_box: 1.0.4
  cached_network_image: 2.0.0
  flutter_downloader: 1.4.4
  path_provider: 1.6.10
  permission_handler: 5.0.1
  ext_storage: 1.0.3
  numberpicker: 1.1.0
  url_launcher: 5.7.10
  country_code_picker: 1.7.0

dev_dependencies:
  flutter_test:
    sdk: flutter
  sqflite: ^1.3.1
  path: ^1.6.4

# 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/images/lght.png
    - assets/icons/
    - assets/images/


  # An image asset can refer to one or more resolution-specific "variants", 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 "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:

  fonts:
    - family: opensans
      fonts:
        - asset: assets/fonts/OpenSans-Bold.ttf
        - asset: assets/fonts/OpenSans-Light.ttf
        - asset: assets/fonts/OpenSans-Regular.ttf
        - asset: assets/fonts/OpenSans-SemiBold.ttf


    - family: roboto
      fonts:
        - asset: assets/fonts/Roboto-Bold.ttf
        - asset: assets/fonts/Roboto-Regular.ttf

    - family: raleway
      fonts:
        - asset: assets/fonts/Raleway-Regular.ttf
0 Answers
Related