1. Home
  2. Docs
  3. Bugfender SDK for Android
  4. Installing with Gradle

Installing with Gradle

Find your module <module>/build.gradle (usually called “Module: app”) and add under dependencies:

implementation 'com.bugfender.sdk:android:3.+'

If you do not have one yet, create an Application class. For that, go to File > New > Kotlin File/Class, call it App and paste the following code:

package your.pkg.name

import android.app.Application

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

Then add the class name by editing AndroidManifest.xml and adding the name attribute to <application> tag, should look like this:

<application
    android:name=".App"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    ...
    </activity>
</application>

Add the lines in bold to your Application class:

package your.pkg.name

import android.app.Application
import com.bugfender.sdk.Bugfender
import com.bugfender.android.BuildConfig

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

        Bugfender.init(this, "YOUR_APP_KEY_HERE", BuildConfig.DEBUG)
        Bugfender.enableCrashReporting()
        Bugfender.enableUIEventLogging(this)
        Bugfender.enableLogcatLogging() // optional, if you want logs automatically collected from logcat
    }
}

If using Java, your Application class will look like this:

package your.package.name;

import android.app.Application;
import com.bugfender.sdk.Bugfender;
import com.bugfender.android.BuildConfig;

public class App extends Application {
    @Override
    public void onCreate() {
        super.onCreate();

        Bugfender.init(this, "YOUR_APP_KEY_HERE", BuildConfig.DEBUG);
        Bugfender.enableCrashReporting();
        Bugfender.enableUIEventLogging(this);
        Bugfender.enableLogcatLogging(); // optional, if you want logs automatically collected from logcat
    }
}