skip to Main Content

I am getting this error Execution failed for task ‘:app:compileFlutterBuildDebug’.
this error have come suddenly, I dont no why.
How to fixed it

/C:/Users/dell/AppData/Local/Pub/Cache/hosted/pub.dev/printing-5.9.3/lib/src/widget_wrapper.dart:234:9: Error: Type 'ui.ViewConfiguration' not found.
  final ui.ViewConfiguration configuration;
        ^^^^^^^^^^^^^^^^^^^^
/C:/Users/dell/AppData/Local/Pub/Cache/hosted/pub.dev/printing-5.9.3/lib/src/widget_wrapper.dart:241:3: Error: Type 'ui.ViewConfiguration' not found.
  ui.ViewConfiguration get viewConfiguration => configuration;
  ^^^^^^^^^^^^^^^^^^^^
/C:/Users/dell/AppData/Local/Pub/Cache/hosted/pub.dev/printing-5.9.3/lib/src/widget_wrapper.dart:174:27: Error: Method not found: 'ViewConfiguration'.
        configuration: ui.ViewConfiguration(
                          ^^^^^^^^^^^^^^^^^
/C:/Users/dell/AppData/Local/Pub/Cache/hosted/pub.dev/printing-5.9.3/lib/src/widget_wrapper.dart:232:3: Error: The superclass, 'ui.FlutterView', has no unnamed constructor that takes no arguments.
  _FlutterView({required this.configuration});
  ^^^^^^^^^^^^
/C:/Users/dell/AppData/Local/Pub/Cache/hosted/pub.dev/printing-5.9.3/lib/src/widget_wrapper.dart:234:12: Error: 'ViewConfiguration' isn't a type.
  final ui.ViewConfiguration configuration;
           ^^^^^^^^^^^^^^^^^
/C:/Users/dell/AppData/Local/Pub/Cache/hosted/pub.dev/printing-5.9.3/lib/src/fonts/font.dart:47:15: Error: 'AssetManifest' is imported from both 'package:flutter/src/services/asset_manifest.dart' and 'package:printing/src/fonts/manifest.dart'.
    if (await AssetManifest.contains(asset)) {
              ^^^^^^^^^^^^^
/C:/Users/dell/AppData/Local/Pub/Cache/hosted/pub.dev/package_info_plus_windows-2.1.0/lib/src/file_version_info.dart:13:17: Error: Field 'wLanguage' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`.
  external int? wLanguage;
                ^
/C:/Users/dell/AppData/Local/Pub/Cache/hosted/pub.dev/package_info_plus_windows-2.1.0/lib/src/file_version_info.dart:16:17: Error: Field 'wCodePage' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`.
  external int? wCodePage;
                ^
Target kernel_snapshot failed: Exception


FAILURE: Build failed with an exception.

* Where:
Script 'C:srcflutterpackagesflutter_toolsgradleflutter.gradle' line: 1153

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:srcflutterbinflutter.bat'' finished with non-zero exit value 1

* 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 1m 1s
Exception: Gradle task assembleDebug failed with exit code 1

this is my app/buld.gradle file

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

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

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

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

android {
    compileSdkVersion 33

    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.example.bellaz"
        minSdkVersion 21
        targetSdkVersion 33
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        multiDexEnabled true
    }

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
            storePassword keystoreProperties['storePassword']
        }
    }

    buildTypes {
        release {
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:multidex:2.0.1'
}

this is my gradle file

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

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.4'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

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
}

this is my pubspex.ymal file

version: 1.0.0+2

environment:
  sdk: '>=2.12.0 <3.0.0'

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.3
  pin_code_fields: ^7.3.0
  intl: ^0.17.0
#  dropdown_formfield: ^0.1.3
  fluttertoast: ^8.0.8
  carousel_slider: ^4.0.0
  flutter_rating_bar: ^4.0.0
  url_launcher: ^6.0.12
  clipboard: ^0.1.3
#  dart_notification_center: ^1.0.0+1
  maps_launcher: ^2.0.1
  share_plus: ^4.0.8
  http: ^0.13.4
  shared_preferences: ^2.0.8
  skeletons: ^0.0.3
  geolocator: ^7.4.0
  flutter_geocoder: ^0.2.2-nullsafety
  cool_dropdown: ^1.4.1
  image_picker: ^0.8.3+2
  another_flushbar: ^1.10.26
  razorpay_flutter: ^1.3.0
  location: ^4.3.0
  google_maps_flutter: ^2.1.1
  map_picker: ^0.0.3
  geocoding: ^2.0.1
  flutter_google_places: ^0.3.0
  pdf: ^3.7.3
  path_provider: ^2.0.9
  open_filex: ^4.3.2
  printing: ^5.9.3
  provider: ^6.0.5


dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_launcher_icons: ^0.9.2
flutter_icons:
  android: "launcher_icon"
  ios: true
  image_path: "lib/Assets/app_icon.png"
# 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

2

Answers


  1. Change your targetSdkVersion to 30 and minSdkVersion to 21 in your app level build.gradle file

     minSdkVersion 21
     targetSdkVersion 33
    

    to

    minSdkVersion 20
    targetSdkVersion 30
    
    Login or Signup to reply.
  2. The issue is with printing and package_info_plus_windows. They are imported in your code.

    • There should be missing some classes and constructors.

    Upgrade or downgrade the packages.

    Update the printing and package_info_plus_windows packages with this command.

    flutter packages upgrade
    

    If it’s not working follow this How to downgrade packages in flutter?.

    flutter packages get
    

    Clean your project with the commands:

    flutter clean
    

    and then

    flutter run
    

    Invalidate caches and restart.


    I would also check the Flutter SDK and for imports. They can create conflicts between the code.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search