Simple Firebase Auth UI check and app crashes












0















I follow the following "how to add firebase ui auth" work flow to my app, and I have a single main activity that just changes a text view if a user is logged or not. this is how the code looks like:



public class MainActivity extends AppCompatActivity {

private static final int RC_SIGN_IN = 123;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
createSignInIntent();

}
public void createSignInIntent() {
// [START auth_fui_create_intent]
// Choose authentication providers
List<AuthUI.IdpConfig> providers = Arrays.asList(
new AuthUI.IdpConfig.EmailBuilder().build());

// Create and launch sign-in intent
startActivityForResult(
AuthUI.getInstance()
.createSignInIntentBuilder()
.setAvailableProviders(providers)
.build(),
RC_SIGN_IN);
// [END auth_fui_create_intent]
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);

if (requestCode == RC_SIGN_IN) {
IdpResponse response = IdpResponse.fromResultIntent(data);

if (resultCode == RESULT_OK) {
TextView tv = (TextView)findViewById(R.id.tv);
tv.setText("Signed");
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
// ...
} else {

// Sign in failed. If response is null the user canceled the
// sign-in flow using the back button. Otherwise check
// response.getError().getErrorCode() and handle the error.
TextView tv = (TextView)findViewById(R.id.tv);
tv.setText("Not Signed In");
}
}
}
}


The app crashes and the Logcat is empty!










share|improve this question

























  • If the app crashes, there is a stack trace. Please look that up on logcat, and add it to your question.

    – Alex Mamo
    Nov 22 '18 at 9:30
















0















I follow the following "how to add firebase ui auth" work flow to my app, and I have a single main activity that just changes a text view if a user is logged or not. this is how the code looks like:



public class MainActivity extends AppCompatActivity {

private static final int RC_SIGN_IN = 123;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
createSignInIntent();

}
public void createSignInIntent() {
// [START auth_fui_create_intent]
// Choose authentication providers
List<AuthUI.IdpConfig> providers = Arrays.asList(
new AuthUI.IdpConfig.EmailBuilder().build());

// Create and launch sign-in intent
startActivityForResult(
AuthUI.getInstance()
.createSignInIntentBuilder()
.setAvailableProviders(providers)
.build(),
RC_SIGN_IN);
// [END auth_fui_create_intent]
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);

if (requestCode == RC_SIGN_IN) {
IdpResponse response = IdpResponse.fromResultIntent(data);

if (resultCode == RESULT_OK) {
TextView tv = (TextView)findViewById(R.id.tv);
tv.setText("Signed");
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
// ...
} else {

// Sign in failed. If response is null the user canceled the
// sign-in flow using the back button. Otherwise check
// response.getError().getErrorCode() and handle the error.
TextView tv = (TextView)findViewById(R.id.tv);
tv.setText("Not Signed In");
}
}
}
}


The app crashes and the Logcat is empty!










share|improve this question

























  • If the app crashes, there is a stack trace. Please look that up on logcat, and add it to your question.

    – Alex Mamo
    Nov 22 '18 at 9:30














0












0








0








I follow the following "how to add firebase ui auth" work flow to my app, and I have a single main activity that just changes a text view if a user is logged or not. this is how the code looks like:



public class MainActivity extends AppCompatActivity {

private static final int RC_SIGN_IN = 123;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
createSignInIntent();

}
public void createSignInIntent() {
// [START auth_fui_create_intent]
// Choose authentication providers
List<AuthUI.IdpConfig> providers = Arrays.asList(
new AuthUI.IdpConfig.EmailBuilder().build());

// Create and launch sign-in intent
startActivityForResult(
AuthUI.getInstance()
.createSignInIntentBuilder()
.setAvailableProviders(providers)
.build(),
RC_SIGN_IN);
// [END auth_fui_create_intent]
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);

if (requestCode == RC_SIGN_IN) {
IdpResponse response = IdpResponse.fromResultIntent(data);

if (resultCode == RESULT_OK) {
TextView tv = (TextView)findViewById(R.id.tv);
tv.setText("Signed");
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
// ...
} else {

// Sign in failed. If response is null the user canceled the
// sign-in flow using the back button. Otherwise check
// response.getError().getErrorCode() and handle the error.
TextView tv = (TextView)findViewById(R.id.tv);
tv.setText("Not Signed In");
}
}
}
}


The app crashes and the Logcat is empty!










share|improve this question
















I follow the following "how to add firebase ui auth" work flow to my app, and I have a single main activity that just changes a text view if a user is logged or not. this is how the code looks like:



public class MainActivity extends AppCompatActivity {

private static final int RC_SIGN_IN = 123;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
createSignInIntent();

}
public void createSignInIntent() {
// [START auth_fui_create_intent]
// Choose authentication providers
List<AuthUI.IdpConfig> providers = Arrays.asList(
new AuthUI.IdpConfig.EmailBuilder().build());

// Create and launch sign-in intent
startActivityForResult(
AuthUI.getInstance()
.createSignInIntentBuilder()
.setAvailableProviders(providers)
.build(),
RC_SIGN_IN);
// [END auth_fui_create_intent]
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);

if (requestCode == RC_SIGN_IN) {
IdpResponse response = IdpResponse.fromResultIntent(data);

if (resultCode == RESULT_OK) {
TextView tv = (TextView)findViewById(R.id.tv);
tv.setText("Signed");
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
// ...
} else {

// Sign in failed. If response is null the user canceled the
// sign-in flow using the back button. Otherwise check
// response.getError().getErrorCode() and handle the error.
TextView tv = (TextView)findViewById(R.id.tv);
tv.setText("Not Signed In");
}
}
}
}


The app crashes and the Logcat is empty!







android firebase firebase-authentication firebaseui






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 '18 at 0:42









Frank van Puffelen

242k29387414




242k29387414










asked Nov 21 '18 at 23:31









FireioFireio

527




527













  • If the app crashes, there is a stack trace. Please look that up on logcat, and add it to your question.

    – Alex Mamo
    Nov 22 '18 at 9:30



















  • If the app crashes, there is a stack trace. Please look that up on logcat, and add it to your question.

    – Alex Mamo
    Nov 22 '18 at 9:30

















If the app crashes, there is a stack trace. Please look that up on logcat, and add it to your question.

– Alex Mamo
Nov 22 '18 at 9:30





If the app crashes, there is a stack trace. Please look that up on logcat, and add it to your question.

– Alex Mamo
Nov 22 '18 at 9:30












1 Answer
1






active

oldest

votes


















0














I've seen this when the libraries of firebase and firebaseUI are not compatible.



In the manifest file check if your firebaseUI correspond to the right one.
This is an example for the firebaseUI 4.2.1



dependencies {
...
implementation 'com.firebaseui:firebase-ui:4.2.1'
implementation 'com.google.firebase:firebase-core:16.0.5'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-database:16.0.5'
}


for a complete list of compatible libriaries of FirebaseUI
check this link Firebase Compatibility






share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53421904%2fsimple-firebase-auth-ui-check-and-app-crashes%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    I've seen this when the libraries of firebase and firebaseUI are not compatible.



    In the manifest file check if your firebaseUI correspond to the right one.
    This is an example for the firebaseUI 4.2.1



    dependencies {
    ...
    implementation 'com.firebaseui:firebase-ui:4.2.1'
    implementation 'com.google.firebase:firebase-core:16.0.5'
    implementation 'com.google.firebase:firebase-auth:16.0.5'
    implementation 'com.google.firebase:firebase-database:16.0.5'
    }


    for a complete list of compatible libriaries of FirebaseUI
    check this link Firebase Compatibility






    share|improve this answer






























      0














      I've seen this when the libraries of firebase and firebaseUI are not compatible.



      In the manifest file check if your firebaseUI correspond to the right one.
      This is an example for the firebaseUI 4.2.1



      dependencies {
      ...
      implementation 'com.firebaseui:firebase-ui:4.2.1'
      implementation 'com.google.firebase:firebase-core:16.0.5'
      implementation 'com.google.firebase:firebase-auth:16.0.5'
      implementation 'com.google.firebase:firebase-database:16.0.5'
      }


      for a complete list of compatible libriaries of FirebaseUI
      check this link Firebase Compatibility






      share|improve this answer




























        0












        0








        0







        I've seen this when the libraries of firebase and firebaseUI are not compatible.



        In the manifest file check if your firebaseUI correspond to the right one.
        This is an example for the firebaseUI 4.2.1



        dependencies {
        ...
        implementation 'com.firebaseui:firebase-ui:4.2.1'
        implementation 'com.google.firebase:firebase-core:16.0.5'
        implementation 'com.google.firebase:firebase-auth:16.0.5'
        implementation 'com.google.firebase:firebase-database:16.0.5'
        }


        for a complete list of compatible libriaries of FirebaseUI
        check this link Firebase Compatibility






        share|improve this answer















        I've seen this when the libraries of firebase and firebaseUI are not compatible.



        In the manifest file check if your firebaseUI correspond to the right one.
        This is an example for the firebaseUI 4.2.1



        dependencies {
        ...
        implementation 'com.firebaseui:firebase-ui:4.2.1'
        implementation 'com.google.firebase:firebase-core:16.0.5'
        implementation 'com.google.firebase:firebase-auth:16.0.5'
        implementation 'com.google.firebase:firebase-database:16.0.5'
        }


        for a complete list of compatible libriaries of FirebaseUI
        check this link Firebase Compatibility







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 22 '18 at 17:16

























        answered Nov 22 '18 at 2:21









        PaoloPaolo

        545




        545
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53421904%2fsimple-firebase-auth-ui-check-and-app-crashes%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            這個網誌中的熱門文章

            Tangent Lines Diagram Along Smooth Curve

            Yusuf al-Mu'taman ibn Hud

            Zucchini