Browse Source

Crash report implementation

pull/24/head
Ezerous 8 years ago
parent
commit
6c4c4df6ab
  1. 5
      .gitignore
  2. 3
      app/build.gradle
  3. 73
      app/src/debug/google-services.json
  4. 2
      app/src/main/java/gr/thmmy/mthmmy/session/SessionManager.java
  5. 41
      app/src/release/java/mthmmy.utils/Report.java
  6. 2
      build.gradle

5
.gitignore

@ -44,4 +44,7 @@ captures/
.externalNativeBuild
### Android Patch ###
gen-external-apklibs
gen-external-apklibs
# Google Services (release build)
app/src/release/google-services.json

3
app/build.gradle

@ -32,6 +32,7 @@ dependencies {
compile 'com.android.support:support-v4:25.0.1'
compile 'com.android.support:cardview-v7:25.0.1'
compile 'com.android.support:recyclerview-v7:25.0.1'
compile 'com.google.firebase:firebase-crash:10.0.1'
compile 'com.squareup.okhttp3:okhttp:3.5.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'
@ -42,3 +43,5 @@ dependencies {
}
compile 'com.mikepenz:fontawesome-typeface:4.7.0.0@aar'
}
apply plugin: 'com.google.gms.google-services'

73
app/src/debug/google-services.json

@ -0,0 +1,73 @@
{
"project_info": {
"project_number": "934432863001",
"firebase_url": "https://mthmmy-debug.firebaseio.com",
"project_id": "mthmmy-debug",
"storage_bucket": "mthmmy-debug.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:934432863001:android:a921e0b04ab1f00b",
"android_client_info": {
"package_name": "gr.thmmy.mtmmy"
}
},
"oauth_client": [
{
"client_id": "934432863001-d5oocs1vdi0pcepesi55a41p7enphfcv.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyD4-gwVcb2Rc8zeT8l1v2Lg1DU0QgfGtk8"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 1,
"other_platform_oauth_client": []
},
"ads_service": {
"status": 2
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:934432863001:android:088be0537ff6b292",
"android_client_info": {
"package_name": "gr.thmmy.mthmmy"
}
},
"oauth_client": [
{
"client_id": "934432863001-d5oocs1vdi0pcepesi55a41p7enphfcv.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyD4-gwVcb2Rc8zeT8l1v2Lg1DU0QgfGtk8"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 1,
"other_platform_oauth_client": []
},
"ads_service": {
"status": 2
}
}
}
],
"configuration_version": "1"
}

2
app/src/main/java/gr/thmmy/mthmmy/session/SessionManager.java

@ -162,7 +162,7 @@ public class SessionManager
//Handle exception
}
catch (InterruptedIOException e){
Report.i(TAG, "Login InterruptedIOException", e); //users cancels LoginTask
Report.i(TAG, "Login InterruptedIOException"); //users cancels LoginTask
return CANCELLED;
}
catch (IOException e) {

41
app/src/release/java/mthmmy.utils/Report.java

@ -1,67 +1,80 @@
package mthmmy.utils;
import android.util.Log;
import com.google.firebase.crash.FirebaseCrash;
public class Report //TODO implement for release
public class Report
{
public static void v (String TAG, String message)
{
Log.v(TAG,message);
log("V", TAG, message);
}
public static void v (String TAG, String message, Throwable tr)
{
Log.v(TAG,message + ": " + tr.getMessage(),tr);
exception("V", TAG, message, tr);
}
public static void d (String TAG, String message)
{
Log.d(TAG,message);
log("D", TAG, message);
}
public static void d (String TAG, String message, Throwable tr)
{
Log.d(TAG,message + ": " + tr.getMessage(),tr);
exception("D", TAG, message, tr);
}
public static void i (String TAG, String message)
{
Log.i(TAG,message);
log("I", TAG, message);
}
public static void i (String TAG, String message, Throwable tr)
{
Log.i(TAG,message + ": " + tr.getMessage(),tr);
exception("I", TAG, message, tr);
}
public static void w (String TAG, String message)
{
Log.w(TAG,message);
log("W", TAG, message);
}
public static void w (String TAG, String message, Throwable tr)
{
Log.w(TAG,message + ": " + tr.getMessage(),tr);
exception("W", TAG, message, tr);
}
public static void e (String TAG, String message)
{
Log.e(TAG,message);
log("E", TAG, message);
}
public static void e (String TAG, String message, Throwable tr)
{
Log.e(TAG,message + ": " + tr.getMessage(),tr);
exception("E", TAG, message, tr);
}
public static void wtf (String TAG, String message)
{
Log.wtf(TAG,message);
log("WTF", TAG, message);
}
public static void wtf (String TAG, String message, Throwable tr)
{
Log.wtf(TAG,message + ": " + tr.getMessage(),tr);
exception("WTF", TAG, message, tr);
}
private static void log(String level, String TAG, String message)
{
FirebaseCrash.log(level + "/" + TAG + ": " + message);
}
private static void exception(String level, String TAG, String message, Throwable tr)
{
FirebaseCrash.log(level + "/" + TAG + ": " + message + ": " + tr.getMessage());
FirebaseCrash.report(tr);
}
}

2
build.gradle

@ -7,7 +7,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}

Loading…
Cancel
Save