0

I can not run my build

I have this code

can you help?

/C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_storage_platform_interface-4.1.0/lib/src/method_channel/utils/exception.dart:19:11: Error: Member not found: 'Error.throwWithStackTrace'.
    Error.throwWithStackTrace(exception, stackTrace);
          ^^^^^^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_storage_platform_interface-4.1.0/lib/src/method_channel/utils/exception.dart:22:9: Error: Member not found: 'Error.throwWithStackTrace'.
  Error.throwWithStackTrace(
        ^^^^^^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_storage_platform_interface-4.1.0/lib/src/method_channel/utils/exception.dart:14:7: Error: A non-null value must be returned since the return type 'Never' doesn't allow null.
Never convertPlatformException(
      ^


FAILURE: Build failed with an exception.

* Where:
Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1070

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\flutter\bin\flutter.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.
dbc
  • 104,963
  • 20
  • 228
  • 340
  • 1
    What's the flutter version on your system? – Tushar Asodariya May 20 '22 at 03:52
  • Possibly a duplicate of [Why is riverpod failing even to initialize in project? Method not found: 'Error.throwWithStackTrace'](https://stackoverflow.com/q/71251830). From the [answer](https://stackoverflow.com/a/71259018) by [Baker](https://stackoverflow.com/users/2301224/baker): *Error.throwWithStackTrace was added in Dart 2.16 (Flutter version 2.10 from Feb 8, 2022)... If your Flutter/Dart version is below that, you'll get the error you saw.* – dbc Jun 19 '22 at 17:03
  • Other possible duplicates: [Flutter - Problem with adding Firebase Messaging](https://stackoverflow.com/q/71259801), [Flutter app running on web failing with error:](https://stackoverflow.com/q/71261321). – dbc Jun 19 '22 at 17:05
  • Does this answer your question? [Flutter - Problem with adding Firebase Messaging](https://stackoverflow.com/questions/71259801/flutter-problem-with-adding-firebase-messaging) – dbc Jun 19 '22 at 17:06
  • any progress this issue ? – Mahmut Enes Çetin Jul 22 '22 at 14:00

1 Answers1

0

First of Fall check the flutter version is 2.8.1 then update by below code and check flutter versio is 3.3.4.

update the flutter: using command :" flutter upgrade "

check command is update is 3.3.4

then maybe you face this problem if your app
minSdkVersion flutter.minSdkVersion if is set in flutter.gradle file in 16 or blow 16 then you go to this directory C:\flutter\packages\flutter_tools\gradle\flutter.gradle and open flutter.gradle in notepade enter image description here .

changing static int minSdkVersion = 16 this to

static int minSdkVersion = 19

[!] Your project requires a newer version of the Kotlin Gradle plugin. │ │ Find the latest version on https://kotlinlang.org/docs/gradle.html#plugin-and-versions, then │ │ update D:\Rohit\FLutter_LAB\example\android\build.gradle: │ │ ext.kotlin_version = ''

and to solve this go to the app\build.gradle :

defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.example.example" minSdkVersion flutter.minSdkVersion targetSdkVersion flutter.targetSdkVersion

    **multiDexEnabled true**  //ADD THIS LINE
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
}