在调试模式下,我的应用程序正在构建,但不是在发布模式下,以及flutter build apk
不工作。编译器在控制台中给出以下错误:
D:All DataSoftwaresLatest Flutterflutter.pub-cachehostedpub.dartlang.orggoogle_maps_flutter-2.0.11androidsrcmainjavaioflutterpluginsgoog
lemapsGoogleMapsPlugin.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
D:All DataSoftwaresLatest Flutterflutter.pub-cachehostedpub.dartlang.orggoogle_maps_flutter-2.0.11androidsrcmainjavaioflutterpluginsgoog
lemapsGoogleMapsPlugin.java:92: error: cannot find symbol
lifecycle = FlutterLifecycleAdapter.getActivityLifecycle(binding);
^
symbol: variable FlutterLifecycleAdapter
location: class GoogleMapsPlugin
Note: D:All DataSoftwaresLatest Flutterflutter.pub-cachehostedpub.dartlang.orggoogle_maps_flutter-2.0.11androidsrcmainjavaioflutterplugin
sgooglemapsConvert.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: D:All DataSoftwaresLatest Flutterflutter.pub-cachehostedpub.dartlang.orggoogle_maps_flutter-2.0.11androidsrcmainjavaioflutterplugin
sgooglemapsTileProviderController.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'.
到目前为止,我所尝试的是:
- 我删除了pubspec。锁定文件,跑扑干净,然后再扑酒吧得到。但这并没有帮助。
- 错误显示在googlemapplugin .java。我编辑了这个文件,它通过删除显示红线,但这也没有帮助。
注意:在迁移到null安全之前,应用程序是完全正常的。
关闭Android studio手动删除Flutter/Flutter中的.pubcache文件夹。注意这是一个隐藏文件夹
那就摆平摆平,摆平摆平,摆平摆平。应该可以。