Flutter Build Error : Dart snapshot generator failed with exit code 254

Viewed 56

When i runned the app its fine but when i build apk, it gives me error

Dart snapshot generator failed with exit code 254 Error: 'package:app/screens/address_add_view.dart': error: lib/screens/address_add_view.dart:72:15: Error: This couldn't be parsed. apiKey: ,

Here is my code :

Future<void> selectedAddress(Prediction? p) async {
    if (p != null) {
      // get detail (lat/lng)
      GoogleMapsPlaces _places = GoogleMapsPlaces(
        //apiKey: Constants.apiKey,
        apiHeaders: await const GoogleApiHeaders().getHeaders(),
      );
      PlacesDetailsResponse detail = await _places.getDetailsByPlaceId(p.placeId!);
      lat = detail.result.geometry?.location.lat;
      long = detail.result.geometry?.location.lng;
      placeId = p.placeId;
      address.text = p.description!;
    }
    FocusScope.of(context).unfocus();
  } 

I tried to flutter clean & delete build folder. But i couldn't solve.

Full output:

 > Dart snapshot generator failed with exit code 254


FAILURE: Build failed with an exception.

* Where:
Script '/Users/mac/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1102

* What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
> Process 'command '/Users/mac/flutter/bin/flutter'' 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

BUİLD FAILED in 1m 58s
Running Gradle task 'assembleRelease'...                          119,7s
Gradle task assembleRelease failed with exit code 1
0 Answers
Related