├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── values │ │ │ │ ├── colors.xml │ │ │ │ ├── styles.xml │ │ │ │ └── strings.xml │ │ │ └── layout │ │ │ │ └── activity_main.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── balsikandar │ │ │ │ └── crashreporter │ │ │ │ └── sample │ │ │ │ ├── CrashReporterSampleApplication.java │ │ │ │ └── MainActivity.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── balsikandar │ │ │ └── crashreporter │ │ │ └── sample │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── balsikandar │ │ └── crashreporter │ │ └── sample │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── crashreporter ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── layout │ │ │ │ ├── crash_log.xml │ │ │ │ ├── exception_log.xml │ │ │ │ ├── custom_item.xml │ │ │ │ ├── crash_reporter_activity.xml │ │ │ │ └── activity_log_message.xml │ │ │ ├── values │ │ │ │ ├── colors.xml │ │ │ │ ├── styles.xml │ │ │ │ └── strings.xml │ │ │ ├── drawable │ │ │ │ ├── ic_warning_black_24dp.xml │ │ │ │ ├── ic_menu_delete_white_24dp.xml │ │ │ │ ├── ic_search_white_24dp.xml │ │ │ │ └── ic_menu_share_white_24dp.xml │ │ │ └── menu │ │ │ │ ├── crash_detail_menu.xml │ │ │ │ └── log_main_menu.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── balsikandar │ │ │ │ └── crashreporter │ │ │ │ ├── utils │ │ │ │ ├── SimplePageChangeListener.java │ │ │ │ ├── Constants.java │ │ │ │ ├── CrashReporterExceptionHandler.java │ │ │ │ ├── CrashReporterNotInitializedException.java │ │ │ │ ├── CrashReporterException.java │ │ │ │ ├── FileUtils.java │ │ │ │ ├── AppUtils.java │ │ │ │ └── CrashUtil.java │ │ │ │ ├── adapter │ │ │ │ ├── MainPagerAdapter.java │ │ │ │ └── CrashLogAdapter.java │ │ │ │ ├── CrashReporterInitProvider.java │ │ │ │ ├── CrashReporter.java │ │ │ │ └── ui │ │ │ │ ├── LogMessageActivity.java │ │ │ │ ├── CrashLogFragment.java │ │ │ │ ├── ExceptionLogFragment.java │ │ │ │ └── CrashReporterActivity.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── balsikandar │ │ │ └── crashreporter │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── balsikandar │ │ └── crashreporter │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro ├── build.gradle └── upload.gradle ├── settings.gradle ├── assets ├── crash_reporter_banner.png ├── sample_app_screenshot.png └── crash_reporter_work_flow.gif ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── gradle.properties ├── gradlew.bat ├── gradlew ├── README.md └── LICENSE /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /crashreporter/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':crashreporter' 2 | -------------------------------------------------------------------------------- /assets/crash_reporter_banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MindorksOpenSource/CrashReporter/HEAD/assets/crash_reporter_banner.png -------------------------------------------------------------------------------- /assets/sample_app_screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MindorksOpenSource/CrashReporter/HEAD/assets/sample_app_screenshot.png -------------------------------------------------------------------------------- /assets/crash_reporter_work_flow.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MindorksOpenSource/CrashReporter/HEAD/assets/crash_reporter_work_flow.gif -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MindorksOpenSource/CrashReporter/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MindorksOpenSource/CrashReporter/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MindorksOpenSource/CrashReporter/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MindorksOpenSource/CrashReporter/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MindorksOpenSource/CrashReporter/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MindorksOpenSource/CrashReporter/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | /.idea 11 | -------------------------------------------------------------------------------- /crashreporter/src/main/res/layout/crash_log.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /crashreporter/src/main/res/layout/exception_log.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Nov 07 17:05:35 CET 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ff4081 4 | #f50057 5 | #cf1162 6 | #ffffff 7 | #000000 8 | 9 | -------------------------------------------------------------------------------- /crashreporter/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ff4081 4 | #f50057 5 | #cf1162 6 | #000000 7 | -------------------------------------------------------------------------------- /crashreporter/src/main/res/drawable/ic_warning_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /crashreporter/src/main/res/drawable/ic_menu_delete_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | -------------------------------------------------------------------------------- /crashreporter/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | CrashReporterSample 3 | Null Pointer 4 | IndexOutOfBound 5 | ClassCast Exeption 6 | ArrayStoreException 7 | Add your own crash and check if it gets logged 8 | 9 | -------------------------------------------------------------------------------- /crashreporter/src/test/java/com/balsikandar/crashreporter/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.balsikandar.crashreporter; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /app/src/test/java/com/balsikandar/crashreporter/sample/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.balsikandar.crashreporter.sample; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /crashreporter/src/main/res/drawable/ic_search_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /crashreporter/src/main/res/menu/crash_detail_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 15 | -------------------------------------------------------------------------------- /crashreporter/src/main/java/com/balsikandar/crashreporter/utils/SimplePageChangeListener.java: -------------------------------------------------------------------------------- 1 | package com.balsikandar.crashreporter.utils; 2 | 3 | import android.support.v4.view.ViewPager; 4 | 5 | /** 6 | * Created by bali on 11/08/17. 7 | */ 8 | 9 | public abstract class SimplePageChangeListener implements ViewPager.OnPageChangeListener { 10 | @Override 11 | public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {} 12 | @Override 13 | public abstract void onPageSelected(int position); 14 | @Override 15 | public void onPageScrollStateChanged(int state) {} 16 | } 17 | -------------------------------------------------------------------------------- /crashreporter/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | CrashReporter 3 | Crashes 4 | Exceptions 5 | View Crash Report 6 | Crash Reporter notifications 7 | Check your crashes and exceptions here. 8 | Are you sure to delete all the crash logs 9 | CANCEL 10 | OK 11 | 12 | -------------------------------------------------------------------------------- /crashreporter/src/main/java/com/balsikandar/crashreporter/utils/Constants.java: -------------------------------------------------------------------------------- 1 | package com.balsikandar.crashreporter.utils; 2 | 3 | /** 4 | * Created by bali on 15/08/17. 5 | */ 6 | 7 | public class Constants { 8 | public static final String EXCEPTION_SUFFIX = "_exception"; 9 | public static final String CRASH_SUFFIX = "_crash"; 10 | public static final String FILE_EXTENSION = ".txt"; 11 | public static final String CRASH_REPORT_DIR = "crashReports"; 12 | public static final int NOTIFICATION_ID = 1; 13 | public static final String CHANNEL_NOTIFICATION_ID = "crashreporter_channel_id"; 14 | public static final String LANDING = "landing"; 15 | } 16 | -------------------------------------------------------------------------------- /crashreporter/src/main/java/com/balsikandar/crashreporter/utils/CrashReporterExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.balsikandar.crashreporter.utils; 2 | 3 | public class CrashReporterExceptionHandler implements Thread.UncaughtExceptionHandler { 4 | 5 | private Thread.UncaughtExceptionHandler exceptionHandler; 6 | 7 | public CrashReporterExceptionHandler() { 8 | this.exceptionHandler = Thread.getDefaultUncaughtExceptionHandler(); 9 | } 10 | 11 | @Override 12 | public void uncaughtException(Thread thread, Throwable throwable) { 13 | 14 | CrashUtil.saveCrashReport(throwable); 15 | 16 | exceptionHandler.uncaughtException(thread, throwable); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/balsikandar/crashreporter/sample/CrashReporterSampleApplication.java: -------------------------------------------------------------------------------- 1 | package com.balsikandar.crashreporter.sample; 2 | 3 | import android.app.Application; 4 | import android.os.Environment; 5 | 6 | import com.balsikandar.crashreporter.CrashReporter; 7 | 8 | import java.io.File; 9 | 10 | /** 11 | * Created by bali on 02/08/17. 12 | */ 13 | 14 | public class CrashReporterSampleApplication extends Application { 15 | 16 | @Override 17 | public void onCreate() { 18 | super.onCreate(); 19 | 20 | if (BuildConfig.DEBUG) { 21 | //initialise reporter with external path 22 | CrashReporter.initialize(this); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /crashreporter/src/main/res/menu/log_main_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /crashreporter/src/main/res/drawable/ic_menu_share_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /crashreporter/src/androidTest/java/com/balsikandar/crashreporter/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.balsikandar.crashreporter; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.balsikandar.crashreporter.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/balsikandar/crashreporter/sample/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.balsikandar.crashreporter.sample; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.balsikandar.crashreporter.sample", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /crashreporter/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 8 | 9 | 14 | 15 | 20 | 21 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/bali/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /crashreporter/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/bali/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion rootProject.ext.compile_sdk_version 5 | buildToolsVersion rootProject.ext.build_tools_version 6 | defaultConfig { 7 | applicationId "com.balsikandar.crashreporter.sample" 8 | minSdkVersion 15 9 | targetSdkVersion rootProject.ext.compile_sdk_version 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | api fileTree(include: ['*.jar'], dir: 'libs') 24 | androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', { 25 | exclude group: 'com.android.support', module: 'support-annotations' 26 | }) 27 | api 'com.android.support:appcompat-v7:' + rootProject.ext.support_version 28 | testImplementation 'junit:junit:4.12' 29 | api project(':crashreporter') 30 | api 'com.google.android:flexbox:0.3.0' 31 | } 32 | -------------------------------------------------------------------------------- /crashreporter/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion rootProject.ext.compile_sdk_version 5 | buildToolsVersion rootProject.ext.build_tools_version 6 | 7 | defaultConfig { 8 | minSdkVersion 15 9 | targetSdkVersion rootProject.ext.compile_sdk_version 10 | versionCode 1 11 | versionName "1.0" 12 | 13 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 14 | 15 | } 16 | buildTypes { 17 | release { 18 | minifyEnabled false 19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 20 | } 21 | } 22 | } 23 | 24 | dependencies { 25 | api fileTree(dir: 'libs', include: ['*.jar']) 26 | androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', { 27 | exclude group: 'com.android.support', module: 'support-annotations' 28 | }) 29 | api 'com.android.support:recyclerview-v7:' + rootProject.ext.support_version 30 | api 'com.android.support:appcompat-v7:' + rootProject.ext.support_version 31 | api 'com.android.support:design:' + rootProject.ext.support_version 32 | testImplementation 'junit:junit:4.12' 33 | } 34 | 35 | //apply from: 'upload.gradle' -------------------------------------------------------------------------------- /crashreporter/src/main/java/com/balsikandar/crashreporter/adapter/MainPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.balsikandar.crashreporter.adapter; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentPagerAdapter; 6 | 7 | import com.balsikandar.crashreporter.ui.CrashLogFragment; 8 | import com.balsikandar.crashreporter.ui.ExceptionLogFragment; 9 | 10 | /** 11 | * Created by bali on 11/08/17. 12 | */ 13 | 14 | public class MainPagerAdapter extends FragmentPagerAdapter { 15 | 16 | private CrashLogFragment crashLogFragment; 17 | private ExceptionLogFragment exceptionLogFragment; 18 | private String[] titles; 19 | 20 | public MainPagerAdapter(FragmentManager fm, String[] titles) { 21 | super(fm); 22 | this.titles = titles; 23 | } 24 | 25 | @Override 26 | public Fragment getItem(int position) { 27 | if (position == 0) { 28 | return crashLogFragment = new CrashLogFragment(); 29 | } else if (position == 1) { 30 | return exceptionLogFragment = new ExceptionLogFragment(); 31 | } else { 32 | return new CrashLogFragment(); 33 | } 34 | } 35 | 36 | @Override 37 | public int getCount() { 38 | return 2; 39 | } 40 | 41 | @Override 42 | public CharSequence getPageTitle(int position) { 43 | return titles[position]; 44 | } 45 | 46 | public void clearLogs() { 47 | crashLogFragment.clearLog(); 48 | exceptionLogFragment.clearLog(); 49 | } 50 | } -------------------------------------------------------------------------------- /crashreporter/src/main/res/layout/custom_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 19 | 20 | 34 | 35 | 41 | -------------------------------------------------------------------------------- /crashreporter/src/main/java/com/balsikandar/crashreporter/utils/CrashReporterNotInitializedException.java: -------------------------------------------------------------------------------- 1 | package com.balsikandar.crashreporter.utils; 2 | 3 | /** 4 | * Created by bali on 02/08/17. 5 | */ 6 | 7 | /** 8 | * An Exception indicating that the Crash Reporter has not been correctly initialized. 9 | */ 10 | public class CrashReporterNotInitializedException extends CrashReporterException { 11 | static final long serialVersionUID = 1; 12 | 13 | /** 14 | * Constructs a CrashReporterNotInitializedException with no additional information. 15 | */ 16 | public CrashReporterNotInitializedException() { 17 | super(); 18 | } 19 | 20 | /** 21 | * Constructs a CrashReporterNotInitializedException with a message. 22 | * 23 | * @param message A String to be returned from getMessage. 24 | */ 25 | public CrashReporterNotInitializedException(String message) { 26 | super(message); 27 | } 28 | 29 | /** 30 | * Constructs a CrashReporterNotInitializedException with a message and inner error. 31 | * 32 | * @param message A String to be returned from getMessage. 33 | * @param throwable A Throwable to be returned from getCause. 34 | */ 35 | public CrashReporterNotInitializedException(String message, Throwable throwable) { 36 | super(message, throwable); 37 | } 38 | 39 | /** 40 | * Constructs a CrashReporterNotInitializedException with an inner error. 41 | * 42 | * @param throwable A Throwable to be returned from getCause. 43 | */ 44 | public CrashReporterNotInitializedException(Throwable throwable) { 45 | super(throwable); 46 | } 47 | } -------------------------------------------------------------------------------- /crashreporter/src/main/res/layout/crash_reporter_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 16 | 17 | 23 | 24 | 28 | 29 | 30 | 31 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /crashreporter/src/main/java/com/balsikandar/crashreporter/utils/CrashReporterException.java: -------------------------------------------------------------------------------- 1 | package com.balsikandar.crashreporter.utils; 2 | 3 | /** 4 | * Created by bali on 02/08/17. 5 | */ 6 | 7 | /** 8 | * Represents an error condition specific to the Crash Reporter for Android. 9 | */ 10 | public class CrashReporterException extends RuntimeException { 11 | static final long serialVersionUID = 1; 12 | 13 | /** 14 | * Constructs a new CrashReporterException. 15 | */ 16 | public CrashReporterException() { 17 | super(); 18 | } 19 | 20 | /** 21 | * Constructs a new CrashReporterException. 22 | * 23 | * @param message the detail message of this exception 24 | */ 25 | public CrashReporterException(String message) { 26 | super(message); 27 | } 28 | 29 | /** 30 | * Constructs a new CrashReporterException. 31 | * 32 | * @param format the format string (see {@link java.util.Formatter#format}) 33 | * @param args the list of arguments passed to the formatter. 34 | */ 35 | public CrashReporterException(String format, Object... args) { 36 | this(String.format(format, args)); 37 | } 38 | 39 | /** 40 | * Constructs a new CrashReporterException. 41 | * 42 | * @param message the detail message of this exception 43 | * @param throwable the cause of this exception 44 | */ 45 | public CrashReporterException(String message, Throwable throwable) { 46 | super(message, throwable); 47 | } 48 | 49 | /** 50 | * Constructs a new CrashReporterException. 51 | * 52 | * @param throwable the cause of this exception 53 | */ 54 | public CrashReporterException(Throwable throwable) { 55 | super(throwable); 56 | } 57 | 58 | @Override 59 | public String toString() { 60 | // Throwable.toString() returns "CrashReporterException:{message}". Returning just "{message}" 61 | // should be fine here. 62 | return getMessage(); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /crashreporter/src/main/res/layout/activity_log_message.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 13 | 19 | 20 | 26 | 27 | 28 | 29 | 32 | 33 | 39 | 40 | 41 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /crashreporter/src/main/java/com/balsikandar/crashreporter/CrashReporterInitProvider.java: -------------------------------------------------------------------------------- 1 | package com.balsikandar.crashreporter; 2 | 3 | /** 4 | * Created by bali on 02/08/17. 5 | */ 6 | 7 | import android.content.ContentProvider; 8 | import android.content.ContentValues; 9 | import android.content.Context; 10 | import android.content.pm.ProviderInfo; 11 | import android.database.Cursor; 12 | import android.net.Uri; 13 | 14 | /** 15 | * Created by amitshekhar on 16/11/16. 16 | */ 17 | 18 | public class CrashReporterInitProvider extends ContentProvider { 19 | 20 | 21 | public CrashReporterInitProvider() { 22 | } 23 | 24 | @Override 25 | public boolean onCreate() { 26 | CrashReporter.initialize(getContext()); 27 | return true; 28 | } 29 | 30 | @Override 31 | public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { 32 | return null; 33 | } 34 | 35 | @Override 36 | public String getType(Uri uri) { 37 | return null; 38 | } 39 | 40 | @Override 41 | public Uri insert(Uri uri, ContentValues values) { 42 | return null; 43 | } 44 | 45 | @Override 46 | public int delete(Uri uri, String selection, String[] selectionArgs) { 47 | return 0; 48 | } 49 | 50 | @Override 51 | public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) { 52 | return 0; 53 | } 54 | 55 | @Override 56 | public void attachInfo(Context context, ProviderInfo providerInfo) { 57 | if (providerInfo == null) { 58 | throw new NullPointerException("CrashReporterInitProvider ProviderInfo cannot be null."); 59 | } 60 | // So if the authorities equal the library internal ones, the developer forgot to set his applicationId 61 | if ("com.balsikandar.crashreporter.CrashReporterInitProvider".equals(providerInfo.authority)) { 62 | throw new IllegalStateException("Incorrect provider authority in manifest. Most likely due to a " 63 | + "missing applicationId variable in application\'s build.gradle."); 64 | } 65 | super.attachInfo(context, providerInfo); 66 | } 67 | 68 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 16 | 17 |