I'm trying to implement App Check in my Flutter app for Android and have followed the flutterfire documentation. I have already complete the installation part outlined here: https://firebase.flutter.dev/docs/app-check/overview Now I am following this documentation for usage: https://firebase.flutter.dev/docs/app-check/usage
So I have added the await FirebaseAppCheck.instance.activate(webRecaptchaSiteKey: 'recaptcha-v3-site-key'); to my Main method, right after the call to initialize firebase.
Now I need to enable debugging with the App Check and the documentation says I should add this dependency to my app/build.gradle file: implementation 'com.google.firebase:firebase-appcheck-debug:16.0.0-beta01' and add the following code snippet to my MainActivity.java onCreate method:
import com.google.firebase.appcheck.FirebaseAppCheck;
FirebaseApp.initializeApp(/*context=*/ this);
FirebaseAppCheck firebaseAppCheck = FirebaseAppCheck.getInstance();
firebaseAppCheck.installAppCheckProviderFactory(DebugAppCheckProviderFactory.getInstance());
Which I have tried to do by creating the MainActivity.java with the following command in my project root folder: flutter create -a java .
So my MainActivity.java looks like this:
import io.flutter.embedding.android.FlutterActivity;
import com.google.firebase.appcheck.FirebaseAppCheck;
public class MainActivity extends FlutterActivity {
      @Override
      protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            FirebaseApp.initializeApp(/*context=*/ this);
            FirebaseAppCheck firebaseAppCheck = FirebaseAppCheck.getInstance();
            firebaseAppCheck.installAppCheckProviderFactory(
            DebugAppCheckProviderFactory.getInstance());
      }
}
When trying to run the app in debug mode I get the this error:  Execution failed for task ':app:compileDebugJavaWithJavac'.
What am I missing? Have seen other posts with the same problem but no solution.
 
    