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
2 Answers
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 Comments
Yusril Dewantara
Yeah man, you drive me into simplest way to solve the problem, anyway the program works properly, but if i open MainActivity.java from flutter app and not from android folder, the R still red
CopsOnRoad
You need to update flutter plugin and dart too then your IDE won't show red R anymore.
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
2 Comments
Yusril Dewantara
its help me a lot, is the configuration between android studio for native and android studio for flutter difference ? because the R still red but the program works properly
Andrii Turkovskyi
I don't know, what you mean saying "configuration". There are totally different project structures.
R has to work. If it still red - check imports / restart studio, try something like this. Such bug can appear even in ordinary native android projects