0

Update

Okay I noticed that this issue is not just Android specific, flutter build ios --release also fails with similar type error log - https://pastebin.pl/view/4539cc24

flutter build apk --release failing with error :

Script '/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1102

  • What went wrong: Execution failed for task ':app:compileFlutterBuildRelease'. Process 'command '/flutter/bin/flutter'' finished with non-zero exit value 1

But flutter pub get, flutter run is working. I've tried doing flutter clean, checked all pubspec.yaml dependencies, updated android build.gradle minimum version to satisfy dependency requirements.

Project environment: sdk: ">=2.16.1 <3.0.0" Flutter version: 2.10.2(stable channel)

Has anyone faced anything such? If so what could be some possible solutions to this issue?

Amani Saaduddin
  • 288
  • 7
  • 23

3 Answers3

1

This link has suggested 3 steps to solve the problem:

Step 1. flutter build apk --debug

Step 2. flutter build apk --profile

Step 3. flutter build apk --release

If it doesn't help you, you can try this solution too.

M Karimi
  • 1,991
  • 1
  • 17
  • 34
0

you need clean your build in file android with cd android & gradlew clean

Then, cd .. & flutter build apk --release

or

flutter build apk --release -vv 
TNTC
  • 69
  • 2
0

The actual issue was with Riverpod usage. As after upgrading to riverpod 1 context.read doesn't work. earlier we could obtain context using global navigation keys. We were trying to obtain Ref from Dart class, which caused the errors. Using ProviderContainer instead solved the issue.

Amani Saaduddin
  • 288
  • 7
  • 23