How to add firebase app check in android app?

Viewed 618

I have registered app check-in firebase for a flutter app. But I couldn't find mainactivity file in my android folder

path/to-java:

---- android
  ---- app
   --- src
    --- main
      --- java
       -- io
          --- flutter 
            --- plugins
                 --- GeneratedPluginRegistrant.java

GeneratedPluginRegistrant.java

path/to-kotlin:

---- android
  ---- app
   --- src
    --- main
      --- kotlin
        --- com
          -- company
           ---- app-name
             ---- MainActivity.kt

MainActivity.kt

package com.company.app_name

import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {
}

I have referred docs but i don't know where to add the files exactly can someone help with that? Thank you

1 Answers

You can create the class file MainActivity.java and It should work:

public class MainActivity extends FlutterActivity {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    GeneratedPluginRegistrant.registerWith(this);
  }
}

and if it does not work, try:

flutter create -a java .

Try this command. with '.' at end. It represent current project directory. apply this command from project root folder. This command will try to recreate android project with java (this will setup your MainActiviy.java). It won't affect currently setup manifest or any other firebase related setup.

Related