Closed
Description
Hey,
Please provide a better explanation of how to integrate App check for android and add working Kotlin snippet, most of the users don't have MainActivity.java only Kotlin MainActivity file and even creating it with flutter create -a java .
and importing java snippet throws an error.
android/app/src/main/java/project_folder/MainActivity
package *name*
import io.flutter.embedding.android.FlutterActivity;
import com.google.firebase.appcheck.FirebaseAppCheck;
public class MainActivity extends FlutterActivity {
FirebaseApp.initializeApp(this);
FirebaseAppCheck firebaseAppCheck = FirebaseAppCheck.getInstance();
firebaseAppCheck.installAppCheckProviderFactory(DebugAppCheckProviderFactory.getInstance());
}
Throws:
Running Gradle task 'assembleDebug'...
/MainActivity.java:8: error: <identifier> expected
FirebaseApp.initializeApp(this);
^
/MainActivity.java:8: error: illegal start of type
FirebaseApp.initializeApp(this);
^
/MainActivity.java:10: error: <identifier> expected
firebaseAppCheck.installAppCheckProviderFactory(DebugAppCheckProviderFactory.getInstance());
^
/MainActivity.java:10: error: <identifier> expected
firebaseAppCheck.installAppCheckProviderFactory(DebugAppCheckProviderFactory.getInstance());
^
4 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 17s
Exception: Gradle task assembleDebug failed with exit code 1
Thanks