Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[馃摎] Appcheck debug build #8425

Closed
cedvdb opened this issue Apr 7, 2022 · 5 comments 路 Fixed by #9445
Closed

[馃摎] Appcheck debug build #8425

cedvdb opened this issue Apr 7, 2022 · 5 comments 路 Fixed by #9445
Assignees
Labels
good first issue Good for newcomers plugin: app_check type: documentation Improvements or additions to documentation

Comments

@cedvdb
Copy link

cedvdb commented Apr 7, 2022

Firebase official documentation says the following :

In your debug build, configure App Check to use the debug provider factory: [code snippet]

Flutter fire documentation says the following

Install the debug provider using the following snippet, e.g. in your MainActivity.java onCreate method:

import com.google.firebase.appcheck.FirebaseAppCheck;

FirebaseApp.initializeApp(/*context=*/ this);
FirebaseAppCheck firebaseAppCheck = FirebaseAppCheck.getInstance();
firebaseAppCheck.installAppCheckProviderFactory(
    DebugAppCheckProviderFactory.getInstance());

The documentation is specifically unclear about debug build. I assume that the above snippet should not be added to the main/MainActivity.kt but to a debug variant. So I tried to create `debug/com/cedvdb/x/MainActivity.kt but this throws the error:

e: Redeclaration: MainActivity

It seems like the debug variant cannot be redeclared like this, but then how ?

It would be nice if the appcheck documentation was updated to cover that debug build point, taking into account that some are not familiar with kotlin.

My final snippet that compiles is:

import io.flutter.embedding.android.FlutterActivity
import android.os.Bundle


import com.google.firebase.FirebaseApp
import com.google.firebase.appcheck.FirebaseAppCheck
import com.google.firebase.appcheck.debug.DebugAppCheckProviderFactory

class MainActivity: FlutterActivity() {
  
  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    FirebaseApp.initializeApp(/*context=*/this)
    val firebaseAppCheck = FirebaseAppCheck.getInstance()
    firebaseAppCheck.installAppCheckProviderFactory(
        DebugAppCheckProviderFactory.getInstance()
    )
  }
}
@cedvdb cedvdb added good first issue Good for newcomers type: documentation Improvements or additions to documentation labels Apr 7, 2022
@darshankawar darshankawar added triage Issue is currently being triaged. plugin: app_check and removed triage Issue is currently being triaged. labels Apr 8, 2022
@gOzaru
Copy link

gOzaru commented Jul 8, 2022

I got this problem too on Android emulator.
There is no a useful documentation from Firebase nor FlutterFire

@iamsethsamuel

This comment was marked as off-topic.

@cedvdb
Copy link
Author

cedvdb commented Jul 21, 2022

don't forget to 馃憤 for visibility

@rohan20
Copy link

rohan20 commented Aug 12, 2022

Using a MethodChannel, you can control that the method channel gets invoked only in kDebugMode from Flutter: https://stackoverflow.com/a/73330541/5066615

@russellwheatley
Copy link
Member

If you wish to follow steps for setting up app check debug, please follow instruction here for android & iOS.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Good for newcomers plugin: app_check type: documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants