-
Notifications
You must be signed in to change notification settings - Fork 1.1k
BasicSetup
F43nd1r edited this page Dec 24, 2017
·
78 revisions
Note: this guide assumes you are using com.android.tools.build:gradle:3.0.0
or later.
Everything you find in this section belongs into the dependencies
block in your build.gradle
:
dependencies {
//here
}
Add the following snippet (with the latest version)
def acraVersion = '5.0.0'
- Http:
implementation "com.faendir.acra:acra-http:$acraVersion"
- Email:
implementation "com.faendir.acra:acra-mail:$acraVersion"
- Custom:
implementation "com.faendir.acra:acra-core:$acraVersion"
- Dialog:
implementation "com.faendir.acra:acra-dialog:$acraVersion"
- Notification:
implementation "com.faendir.acra:acra-notification:$acraVersion"
- Toast:
implementation "com.faendir.acra:acra-toast:$acraVersion"
- Silent:
Add nothing.
- Limiter: (limits how many reports acra sends from one device)
implementation "com.faendir.acra:acra-toast:$acraVersion"
If you don't already have an Application class, then create one. Apply the configuration to your Application class.
Creating an Application class
- Create a new class in your package root.
- Give it a name like:
MyApplication
extending fromandroid.app.Application
(or another subclass of that) - Update the
application
element in your AndroidManifest to reference the new class.
Add annotations to your Application class and override the attachBaseContext()
method to add ACRA.init(this);
. In our newly created class, it looks like:
import org.acra.*;
import org.acra.annotation.*;
@AcraCore(buildConfigClass = BuildConfig.class)
public class MyApplication extends Application {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
// The following line triggers the initialization of ACRA
ACRA.init(this);
}
}
I addition to the @AcraCore
annotation, each plugin you added in the dependencies step provides another annotation, which you have to add to activate and configure that plugin: