Error when I run flutter doctor –android-licenses

huangapple go评论55阅读模式
英文:

Error when I run flutter doctor --android-licenses

问题

Exception in thread "main" java.lang.UnsupportedClassVersionError: com/android/prefs/AndroidLocationsProvider has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

I tried also JDK 11 but it doesn't work.
How do I fix?

英文:

Exception in thread "main" java.lang.UnsupportedClassVersionError: com/android/prefs/AndroidLocationsProvider has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

I tried also JDK 11 but it doesn't works.
How do I fix?

Error when I run flutter doctor –android-licenses

答案1

得分: 0

这个错误告诉我们,我们的类是在比我们尝试运行它的Java版本更高的版本中编译的。更具体地说,在这种情况下,我们使用Java 11编译了我们的类,然后尝试在Java 8上运行它。

我们有两种方法可以解决这个错误:要么为较早的Java版本编译我们的代码,要么在较新的Java版本上运行我们的代码。

我认为这个网站可能会对你有所帮助 https://www.baeldung.com/java-lang-unsupportedclassversion

英文:

This error is telling us that our class was compiled at a higher version of Java than the version with which we tried to run it. More specifically, in this case we compiled our class with Java 11 and tried to run it with Java 8.

we have two ways we can resolve this error: compile our code for an earlier version of Java, or run our code on a newer Java version.

I think this website might help you https://www.baeldung.com/java-lang-unsupportedclassversion

答案2

得分: 0

  1. 我也遇到了这个问题

  2. 删除
    这里删除两个文件夹和备份
    输入图片描述

  3. 重新启动

  4. 修改 java_home 为 java11
    运行 flutter doctor --android-licenses
    成功;
    > 我的想法
    运行 flutter doctor -v
    发现在 Android Studio 中的 android jre,
    切换 Java 版本没有效果
    已经提交了这个错误,然后考虑首先卸载 Android Studio
    然后重新启动切换到 java11 的 javahome 路径
    再次运行 'flutter doctor --android-licenses'
    成功!
    开心(不排除是我的操作问题,这是我的解决方案,希望能帮助,欢迎指正,谢谢!)
    无法找到 Android 下载管理器,可以检查最新版本
    工具

英文:

I also met this problem

  1. del
    Two folders and delete backup here
    enter image description here

  2. restart

  3. Modify the java_home java11
    flutter doctor --android-licenses
    SUCCESS;
    > my idea
    flutter doctor -v
    Found that he is the android jre in the studio,
    Switch the Java version has no effect
    Has been submitted to the error in this, and then think of first take the Android's studio
    After the restart switch to java11 javahome path
    Performed again 'flutter doctor --android-licenses'
    SUCCESS!
    happy(Do not rule out is my operational problems, this is my solution, hope to bring help, welcome to correct me, thank you!)
    Can't find the android download manager can check the latest
    tools

huangapple
  • 本文由 发表于 2023年2月19日 18:44:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/75499549.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定