How to combine java native within the XML android and dart Flutter

十年热恋 提交于 2019-12-11 17:09:06

问题


I've been searching for tutorial that relates to combine native android and dart, so far this is the best https://proandroiddev.com/communication-between-flutter-and-native-modules-9b52c6a72dd2 but it wrote in kotlin, i also try to write the code on java, but when i try to call XML file and the widget using "R" are getting error, it said "cannot resolve symbol", a lot of people said that R problem are solved by clean project or rebuild, but i'm using flutter in android studio which is feature to sync, clean, or rebuild are unavailable. If you guys know the solutions i'm so glad if you wanna help

Here's my code


回答1:


Open Android Studio, click on File > Open and choose the android folder of your flutter app project, it should be in the root directory of your app project.

That's it.




回答2:


In your_project folder you have 3 packages - lib, android and ios. If you want to work with your activity - you have to open project, which located on your_project/android. After that this problem with R have have to disappear



来源:https://stackoverflow.com/questions/53118822/how-to-combine-java-native-within-the-xml-android-and-dart-flutter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!