flutter工程,无法运行,报错:The ‘java‘ plugin has been applied, but it is not compatible

Posted tower888

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了flutter工程,无法运行,报错:The ‘java‘ plugin has been applied, but it is not compatible相关的知识,希望对你有一定的参考价值。

新建的flutter工程,无法运行,报错:
Build file 'I:\\workspace_flutter\\flutter_app_2\\android\\build.gradle' line: 32
* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
  > The 'java' plugin has been applied, but it is not compatible with the Android plugins.

现象:
GeneratedPluginRegistrant里面飘红,androidx.annotation.NonNull等无法找到依赖,
无法运行新建的flutter工程

原因:
本机gradle本地库下面的init.gradle文件以前做过java项目改过的,将init.gradle直接改名为bak后缀,或者删除
就可以编译运行了, 即使GeneratedPluginRegistrant里面飘红报错 都不影响运行.

参考:
gradle - Error:The 'java' plugin has been applied, but it is not compatible with the Android plugins. AndroidStudio 3.0 - Stack Overflow  https://stackoverflow.com/questions/47109815/errorthe-java-plugin-has-been-applied-but-it-is-not-compatible-with-the-andr

以上是关于flutter工程,无法运行,报错:The ‘java‘ plugin has been applied, but it is not compatible的主要内容,如果未能解决你的问题,请参考以下文章

m1版Mac运行Flutter项目报错:Kotlin could not find the required JDK tools in the Java ...

m1版Mac运行Flutter项目报错:Kotlin could not find the required JDK tools in the Java ...

Flutter 报错“Cannot access the body fields of a Request”

3.第二节 - Flutter教程 — 第一次运行Flutter工程时的Bug总结

Flutter报错 Waiting for another flutter command to release the startup lock...

升级后 Flutter 无法在 IOS 和 Android 上运行