美文网首页
error: package androidx.lifecycl

error: package androidx.lifecycl

作者: 天雨霖 | 来源:发表于2020-11-24 16:23 被阅读0次

    C:\flutter-sdk\.pub-cache\hosted\pub.dartlang.org\flutter_plugin_android_lifecycle-1.0.8\android\src\main\java\io\flutter\embedding\engine\plugins\lifecycle\FlutterLifecycleAdapter.java:8: error: package androidx.lifecycle does not exist

    import androidx.lifecycle.Lifecycle;

    C:\flutter-sdk\.pub-cache\hosted\pub.dartlang.org\flutter_plugin_android_lifecycle-1.0.8\android\src\main\java\io\flutter\embedding\engine\plugins\lifecycle\FlutterLifecycleAdapter.java:22: error: cannot find symbol

    public static Lifecycle getActivityLifecycle(

    symbol: class Lifecycle

    location: class FlutterLifecycleAdapter

    解决方案:

    I added the required Gradle dependency implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' in build.gradle file in path : [flutter sdk directory]\.pub-cache\hosted\pub.dartlang.org\flutter_plugin_android_lifecycle-1.0.8\android\build.gradle and error gone in the next flutter build apk --release run.

    在插件flutter_plugin_android_lifecycle最新版本的相关文件:android\build.gradle  下新增行:

    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'

    位置如下图所示:

    新增代码位置

    来源:https://github.com/flutter/flutter/issues/60883


    相关文章

      网友评论

          本文标题:error: package androidx.lifecycl

          本文链接:https://www.haomeiwen.com/subject/ckaiiktx.html