Commit 9e273858 authored by Lucio Maciel's avatar Lucio Maciel

Initial Crashlytics support

parent ac8ea75a
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: 'kotlin-android'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.jakewharton.hugo'
......@@ -9,6 +15,7 @@ buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
......@@ -22,6 +29,7 @@ buildscript {
classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.github.triplet.gradle:play-publisher:1.1.5'
classpath 'io.fabric.tools:gradle:1.+'
}
// Exclude the version that the android plugin depends on.
......@@ -134,6 +142,9 @@ dependencies {
compile "com.github.hotchemi:permissionsdispatcher:$permissionsdispatcherVersion"
annotationProcessor "com.github.hotchemi:permissionsdispatcher-processor:$permissionsdispatcherVersion"
compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
transitive = true;
}
}
apply plugin: 'com.google.gms.google-services'
......@@ -69,5 +69,8 @@
<action android:name="com.google.android.gms.iid.InstanceID"/>
</intent-filter>
</service>
<meta-data
android:name="io.fabric.ApiKey"
android:value="12ac6e94f850aaffcdff52001af77ca415d06a43" />
</application>
</manifest>
\ No newline at end of file
......@@ -2,9 +2,11 @@ package chat.rocket.android;
import android.os.StrictMode;
import android.support.multidex.MultiDexApplication;
import com.crashlytics.android.Crashlytics;
import com.facebook.stetho.Stetho;
import com.uphyca.stetho_realm.RealmInspectorModulesProvider;
import io.fabric.sdk.android.Fabric;
import java.util.List;
import chat.rocket.android.helper.OkHttpHelper;
import chat.rocket.persistence.realm.RealmStore;
......@@ -24,6 +26,7 @@ public class RocketChatApplication extends MultiDexApplication {
}
super.onCreate();
Fabric.with(this, new Crashlytics());
RocketChatPersistenceRealm.init(this);
......
package chat.rocket.android.helper;
import com.crashlytics.android.Crashlytics;
import com.google.firebase.crash.FirebaseCrash;
import bolts.Continuation;
......@@ -11,14 +12,16 @@ import chat.rocket.android.log.RCLog;
* Bolts-Task continuation for just logging if error occurred.
*/
public class LogIfError implements Continuation {
@Override
public Object then(Task task) throws Exception {
if (task.isFaulted()) {
if (BuildConfig.DEBUG) {
RCLog.w(task.getError());
}
FirebaseCrash.report(task.getError());
@Override
public Object then(Task task) throws Exception {
if (task.isFaulted()) {
if (BuildConfig.DEBUG) {
RCLog.w(task.getError());
}
FirebaseCrash.report(task.getError());
Crashlytics.logException(task.getError());
}
return task;
}
return task;
}
}
package chat.rocket.android.helper;
import com.crashlytics.android.Crashlytics;
import com.google.firebase.crash.FirebaseCrash;
public class Logger {
public static void report(Throwable throwable) {
FirebaseCrash.report(throwable);
}
public static void report(Throwable throwable) {
FirebaseCrash.report(throwable);
Crashlytics.logException(throwable);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment