简体   繁体   English

编译错误 Flutter ArCore 插件“类型不匹配:推断类型是 Activity?但 Activity 是预期的”

[英]Compilation Error Flutter ArCore plugin "Type mismatch: inferred type is Activity? but Activity was expected"

I prepared everything in my flutter project for ArCore according to https://developers.google.com/ar/develop/java/enable-arcore?hl=en我根据https://developers.google.com/ar/develop/java/enable-arcore?hl=en在我的 flutter 项目中为 ArCore 准备了一切

(changes in AndroidManifest, build.gradle, gradle.properties). (AndroidManifest、build.gradle、gradle.properties 的变化)。 When trying to run the app I get the following error:尝试运行该应用程序时出现以下错误:

e: C:\Flutter\flutter_windows_3.3.1-stable\flutter.pub-cache\hosted\pub.dartlang.org\arcore_flutter_plugin-0.0.11\android\src\main\kotlin\com\difrancescogianmarco\arcore_flutter_plugin\ArcoreFlutterPlugin.kt: (32, 74): Type mismatch: inferred type is Activity? e: C:\Flutter\flutter_windows_3.3.1-stable\flutter.pub-cache\hosted\pub.dartlang.org\arcore_flutter_plugin-0.0.11\android\src\main\kotlin\com\difrancescogianmarco\arcore_flutter_plugin\ArcoreFlutterPlugin.kt : (32, 74): 类型不匹配:推断类型是 Activity? but Activity was expected但活动是预期的

  • What went wrong: Execution failed for task ':arcore_flutter_plugin:compileDebugKotlin'.出了什么问题:任务 ':arcore_flutter_plugin:compileDebugKotlin' 执行失败。 Compilation error.编译错误。 See log for more details查看日志了解更多详情

I tried deleting "?"我试着删除“?” next to Activity in ArCoreView.kt line在 ArCoreView.kt 行中的 Activity 旁边

 override fun onActivityCreated(activity: Activity?, savedInstanceState: Bundle?) {

but it didn't help.但它没有帮助。 It looks like the problem is with the plugin.看起来问题出在插件上。 What other changes in its code should help?其代码的哪些其他更改应该有所帮助? Is any of its version working correctly?它的任何版本是否正常工作? Or what other thing to change to make it work?或者还有什么其他的改变才能让它发挥作用?

You are using flutter version 3.3.1 which is null safe version and arcore_flutter_plugin version is 0.0.11, which is not null safe plugin.您正在使用 flutter 版本 3.3.1,这是 null 安全版本,arcore_flutter_plugin 版本是 0.0.11,不是 null 安全插件。 please use null safe version.请使用 null 安全版。

please use below version of arcore_flutter_plugin请使用以下版本的 arcore_flutter_plugin

arcore_flutter_plugin: ^0.1.0-null-safety.3 arcore_flutter_plugin: ^0.1.0-null-safety.3

The only solution that worked for me was downgrading flutter to last non null-safety version (2.10.5)唯一对我有用的解决方案是将 flutter 降级到最后一个非空安全版本 (2.10.5)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:类型不匹配:推断类型是活动? 但预计会有活动 - Flutter - Error: Type mismatch: inferred type is Activity? but Activity was expected - Flutter 类型不匹配:推断类型是 Activity? 但活动是预期的 - Type mismatch: inferred type is Activity? but Activity was expected Kotlin 类型不匹配:推断类型是活动? 但将 flutter 升级到 3.0.0 后,预计会出现 ERROR - Kotlin Type mismatch: inferred type is Activity? but Context was expected ERROR after upgrading flutter to the 3.0.0 JitsiMeetPlugin.kt: (66, 42): 类型不匹配:推断类型是 Activity? 但预计会有活动 - JitsiMeetPlugin.kt: (66, 42): Type mismatch: inferred type is Activity? but Activity was expected 类型不匹配:推断类型是字符串? 但预计字符串 flutter - Type mismatch: inferred type is String? but String was expected flutter Flutter:类型不匹配:推断类型是字符串? 但字符串是预期的 - Flutter : Type mismatch: inferred type is String? but String was expected 类型不匹配:推断类型是字符串? 但是在颤振升级后,项目中的字符串预计会出错 - Type mismatch: inferred type is String? but String was expected error in projects after flutter upgrade 如何解决错误:类型不匹配:推断的类型是字符串? 但字符串是预期的 - How to solve error: Type mismatch: inferred type is String? but String was expected 类型不匹配:推断类型是 PluginRegistry? 但 FlutterEngine 是意料之中的 - Type mismatch: inferred type is PluginRegistry? but FlutterEngine was expected 类型不匹配:推断类型是布尔值? 但布尔值是预期的 - Type mismatch: inferred type is Boolean? but Boolean was expected
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM