MainActivity.java file missing

Hi,
I have by mistake delected my MainActivity.java file from src/java in my flutter project.
I created an app bundle and uploaded it on play store . However it crashes on startup. Attached the error log below


I believe the issue is with MainActivity.java missing file.
Please let know how to recreate the MainActivity.java file if this is the problem or any another issue why my app crashes once I download from play store otherwise work fine.
Thanks in advance.

Try running the following command inside root folder of flutter project.
flutter create .

This might help.

I am new to flutter .please can you show image snapshot. How .thanks

This is how you do it using android studio.
Please note, in my case flutter project name is “temp1” (which is the root folder of flutter project)
In the bottom-left, you will see a tab called “Terminal”, click on it.
Then enter the below command
flutter create .

Have I done it right .

Should this create Kotlin MainActivity.kt file or I have to Invalidate caches / restart.
Thanks in advance

This happen after I did as your said

flutter create .
Will create the deleted MainActivity.kt
So you don’t have create it manually.
Run
flutter clean
Once that is done, launch your app and your app should not crash.

Thanks a ton . Will run flutter clean


Can I do in form here.
Thanks in advance.

Hello Mahesh,
Really sorry to bother you once again.
As I was searching for the solution for the above problem.
I updated flutter SDK and gradle ( in Android studio )
Now a thrid party dart package image_gallery_saver is not working.
I have update by pubspec.ylam too.
May not help me on this.
Thanks in advance .