【发布时间】:2020-08-22 04:21:51
【问题描述】:
我想在flutter中使用local_auth插件,它需要Android生命周期,所以我安装了flutter_plugin_android_lifecycle,但是如果我尝试发布apk会出现这个错误:错误: 包 androidx.lifecycle 不存在。我尝试了很多东西,但我就是无法让它发挥作用。
''' C:\flutter.pub-cache\hosted\pub.dartlang.org\flutter_plugin_android_lifecycle-1.0.7\android\src\main\java\io\flutter\embedding\engine\plugins\lifecycle\FlutterLifecycleAdapter.java:8: 错误: 包 androidx.lifecycle 不存在 导入androidx.lifecycle.Lifecycle; ^ C:\flutter.pub-cache\hosted\pub.dartlang.org\flutter_plugin_android_lifecycle-1.0.7\android\src\main\java\io\flutter\embedding\engine\plugins\lifecycle\FlutterLifecycleAdapter.java:22:错误: 找不到标志 公共静态生命周期 getActivityLifecycle( ^ 符号:类生命周期 位置:类 FlutterLifecycleAdapter 2 个错误
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':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 1s
'''
【问题讨论】: