Cannot get property '?' on null object error when flutter build apk

Viewed 54

In my case I run flutter build apk -t lib/main_dev.dart --release --flavor=dev command to build a release APK, I have setup build flavors in my project. But after I run that command it gives "A problem occurred evaluating project ':app'.> Cannot get property '?' on null object" error. Here is my app level build.gradle file,

android {
    compileSdkVersion 31

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }
                                                                                                                                 
    lintOptions {                                                                                                                            
        checkReleaseBuilds false                                                                                                                                                                                                                                                 │
    }

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

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

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

    flavorDimensions "app"

    productFlavors {
        dev {
            dimension "app"
            versionNameSuffix "-dev"
            resValue "string", "app_name", "GetIn Dev"
            resValue "string", "facebook_app_id", "5982**********"
            resValue "string", "facebook_client_token", "d8f78c******************"
            resValue "string", "fb_login_protocol_scheme", "fb*****************"
        }
        prod {
            dimension "app"
            applicationId "com.getin.app"
            resValue "string", "app_name", "GetIn"
            resValue "string", "facebook_app_id", "5982**********"
            resValue "string", "facebook_client_token", "d8f78c******************"
            resValue "string", "fb_login_protocol_scheme", "fb*****************"
        }
    }

}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.google.firebase:firebase-crashlytics'
}

Here is the given error, enter image description here

As the image, it shows error is on line number 42, in line number 42 it has this,

enter image description here

0 Answers
Related