flutter编译报错解决

flutter编译报错解决

问题一:java.lang.AssertionError: annotationType(): unrecognized Attribute name MODULE (class com.sun.xxx)
n exception has occurred in the compiler (1.8.0_242-release). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.AssertionError: annotationType(): unrecognized Attribute name MODULE (class com.sun.tools.javac.util.UnsharedNameTable$NameImpl)
at com.sun.tools.javac.util.Assert.error(Assert.java:133)
at com.sun.tools.javac.code.TypeAnnotations.annotationType(TypeAnnotations.java:231)
at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.separateAnnotationsKinds(TypeAnnotations.java:294)
at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitMethodDef(TypeAnnotations.java:1066)
at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:778)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:275)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)

解决方法:将jdk8改为jdk11就可以。
修改方法:在gradle.properties文件添加jdk路径。
在这里插入图片描述

问题二:安装应用一直卡在Installing build/app/outputs/flutter-apk/app.apk…不动。

在这里插入图片描述
解决方法:官方文档有解决方法,参考链接
https://flutteragency.com/flutter-run-stuck-at-installing-apk/
在这里插入图片描述
主要是先修改applicationId为其它的包名(跟原来的不一样就可以),然后依次执行flutter clean和flutter run就可以了。不行的话再重启一下AS。

问题三:CocoaPods not installed Skipping pod install。

使用AS通过run 将flutter 应用安装到iPhone报错:

Warning: CocoaPods not installed. Skipping pod install. CocoaPods is used to retrieve the iOS and macOS platform side’s plugin code that responds to your plugin usage on the Dart side. Without CocoaPods, plugins will not work on iOS or macOS. For more info, see https://flutter.dev/platform-plugins To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.

Exception: CocoaPods not installed or not in valid state.

看报错是没有安装CocoaPods或者CocoaPods不正确,实际CocoaPods已经安装。
解决方法:参考链接https://stackoverflow.com/questions/68446186/flutter-warning-cocoapods-not-installed-skipping-pod-install-even-while-inst

  • 方法一:使用flutter run安装。
  • 方法二:先关闭AS和xcode的,在命令窗口使用open /Applications/Android\ Studio.app指令打开AS,再进入ios目录执行open Runner.xcworkspace指令打开xcode,这时候再安装就OK了
    在这里插入图片描述在这里插入图片描述
  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值