0

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 enter image description here

2 Answers 2

5

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.

Sign up to request clarification or add additional context in comments.

2 Comments

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
You need to update flutter plugin and dart too then your IDE won't show red R anymore.
1

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

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
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.