Может создавать приложение в режиме отладки, но не в режиме выпуска Flutter

#flutter #dart

Вопрос:

Я сталкиваюсь со следующей ошибкой в консоли при запуске в режиме выпуска.

 C:UsersBilal SaeedAppDataLocalPubCachehostedpub.dartlang.orggoogle_maps_flutter-2.1.0androidsrcmainjavaioflutterpluginsgooglemapsGoogl
eMapsPlugin.java:19: error: cannot find symbol
import io.flutter.embedding.engine.plugins.lifecycle.FlutterLifecycleAdapter;
                                                    ^
  symbol:   class FlutterLifecycleAdapter
  location: package io.flutter.embedding.engine.plugins.lifecycle
C:UsersBilal SaeedAppDataLocalPubCachehostedpub.dartlang.orggoogle_maps_flutter-2.1.0androidsrcmainjavaioflutterpluginsgooglemapsGoogl
eMapsPlugin.java:92: error: cannot find symbol
    lifecycle = FlutterLifecycleAdapter.getActivityLifecycle(binding);
                ^
  symbol:   variable FlutterLifecycleAdapter
  location: class GoogleMapsPlugin
Note: C:UsersBilal SaeedAppDataLocalPubCachehostedpub.dartlang.orggoogle_maps_flutter-2.1.0androidsrcmainjavaioflutterpluginsgooglemaps
Convert.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:UsersBilal SaeedAppDataLocalPubCachehostedpub.dartlang.orggoogle_maps_flutter-2.1.0androidsrcmainjavaioflutterpluginsgooglemaps
TileProviderController.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':google_maps_flutter:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* 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 3m 14s
Running Gradle task 'assembleRelease'...                          195.8s
Gradle task assembleRelease failed with exit code 1
 

То, что я пробовал до сих пор.

  1. Добавлена эта строка в gradle.properties.
 org.gradle.jvmargs=-Xmx4608m
 
  1. В Android Studio
 File > Invalidate Caches/Restart... 
 
    • Удалил всю папку pub_cache.
    • Перезапустил свою студию Android.
    • Побежал flutter clean , flutter pub get , flutter upgrade .
  1. Также запустил команду восстановления кэша flutter pub.

Но ни одно решение не сработало.