Skip to content

Latest commit

 

History

History
67 lines (57 loc) · 1.47 KB

README.md

File metadata and controls

67 lines (57 loc) · 1.47 KB

TimberDialog

Simple dialog which lets to check the logs from Timber. Logs can be shared as .log file.

Based on the dialog from u2020 app.

Demo

Add dependency

Add it in your root build.gradle:

allprojects {
    repositories {
        // ...
        maven { url "https://jitpack.io" }
    }
}

Add the dependency:

dependencies {
    debugImplementation 'com.github.antonygolovin:timberdialog:0.1'
}

Plant a tree

Use LumberYard class:

class App : Application() {
    override fun onCreate() {
        super.onCreate()

        Timber.plant(Timber.DebugTree())

        LumberYard.getInstance(this).let {
            it.cleanUp()
            Timber.plant(it.tree())
        }
    }
}

Edit app's AndroidManifest.xml

Add provider inside <application> node:

<provider
    android:name="android.support.v4.content.FileProvider"
    android:authorities="${applicationId}"
    android:exported="false"
    android:grantUriPermissions="true">
    <meta-data
        android:name="android.support.FILE_PROVIDER_PATHS"
        android:resource="@xml/file_paths" />
    </provider>

Add res/xml/file_paths.xml:

<?xml version="1.0" encoding="utf-8"?>
<paths>
    <external-path
        name="logs"
        path="/" />
</paths>