Instantly share code, notes, and snippets.

Embed
What would you like to do?
Firebase Twitter login and Fabric crash solution guid

Fix Fabric and Twitter login Firebase-ui-auth

  1. Create an application class, is a simple class wich extend the class application
  2. Inside your application class, put the solution provided. Since we are on it, we can also enable offline persistence for Firebase database
  3. Register your class in the AndroidManifest.xml
  4. Please be aware that there are 2 problems solved there, conflict with RTL and the original crash with Twitter login
  5. Fix the graddle, if by any chance you the 'maven { url 'https://maven.fabric.io/public' }' in the general project graddle, remove it from there. Fabric allready added to your app graddle.
  6. Remember to use the latest Firebase-ui-auth version, there is a Twitter conflict with reusable email solved alrready.
<!--You can see here, that there are 2 attributes added. First tools:replace="android:supportsRtl" is ment to fix the rtl merge conflict
and android:name=".YourApp" is ment to register the class extending application as your app-->
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="false"
android:theme="@style/AppTheme"
android:name=".YourApp"
tools:replace="android:supportsRtl">
</application>
public class YourApp extends Application {
@Override
public void onCreate() {
super.onCreate();
TwitterAuthConfig authConfig = new TwitterAuthConfig(getString(R.string.twitter_consumer_key), getString(R.string.twitter_consumer_secret));
Fabric.with(this, new Twitter(authConfig), new Crashlytics());
//You will probably be using the Firebase RealTime Database, and since we are creating this application class,
//go a head and uncomment below line to activate offline feature
//FirebaseDatabase.getInstance().setPersistenceEnabled(true);
}
}
@Andrewwallace59

This comment has been minimized.

Show comment
Hide comment
@Andrewwallace59

Andrewwallace59 Mar 23, 2018

Hey, Thanks for posting this it helped me resolve the issue I was having. Thought I would pitch this in as well in case anyone needs the debug option too:

    final Fabric fabric = new Fabric.Builder(this)
            .kits(new Twitter(authConfig), new Crashlytics())
            .debuggable(true)           // Enables Crashlytics debugger
            .build();
    Fabric.with(fabric);

Andrewwallace59 commented Mar 23, 2018

Hey, Thanks for posting this it helped me resolve the issue I was having. Thought I would pitch this in as well in case anyone needs the debug option too:

    final Fabric fabric = new Fabric.Builder(this)
            .kits(new Twitter(authConfig), new Crashlytics())
            .debuggable(true)           // Enables Crashlytics debugger
            .build();
    Fabric.with(fabric);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment