简体   繁体   English

Flutter + Android Studio:无法解析外部库中的Java符号

[英]Flutter+Android Studio: Can't resolve Java symbols from external libraries

I'm trying to build a Flutter app that also runs custom Java code, so that I can execute code in the background, set alarms etc. As such, I'd like to access Firebase from Java. 我正在尝试构建一个同时运行自定义Java代码的Flutter应用程序,以便我可以在后台执行代码,设置警报等。因此,我想从Java访问Firebase。

I've created a new Flutter project in Android Studio and added Firebase as documented here (manually). 我在Android Studio中创建了一个新的Flutter项目,并在此处 (手动)添加了Firebase。

It compiles and runs fine on the device, but it seems that the dependency .jars from Gradle are not picked up in Android Studio, and as a result my Java source files show a lot of errors - source being "cannot resolve symbol 'google'" in the import statements. 它在设备上编译并运行良好,但似乎在Android Studio中没有拾取Gradle的依赖.jars,因此我的Java源文件显示了很多错误 - 来源是“无法解析符号'google' “在进口报表中。

Is there anything special that I need to do in order to have Android Studio pick up external Java dependencies from Gradle in Flutter application projects? 为了让Android Studio在Flutter应用程序项目中从Gradle中获取外部Java依赖项,我需要做些什么特别的事情吗? I'm running Android Studio 3.0 Beta 7. 我正在运行Android Studio 3.0 Beta 7。

I have the same issue and would love to find the solution. 我有同样的问题,很想找到解决方案。 I tried directly downloading the .aar file and using this guide but it did not work either. 我尝试直接下载.aar文件并使用本指南,但它也无法正常工作。

https://github.com/yushulx/flutter-android-aar https://github.com/yushulx/flutter-android-aar

Edit: I found an open issue on the topic which can be found here . 编辑:我发现了一个关于这个主题的公开问题,可以在这里找到 Clearly you have found it, but in case anyone else is looking for more information about this. 显然你已经找到它,但万一其他人正在寻找有关这方面的更多信息。

Edit 2: Here is a workaround. 编辑2: 这是一个解决方法。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM