Please refer to this page if you're migrating from chucker version 2.0.4
to 3.x
.
In this page you will find the summary of all the breaking changes that you potentially need to fix.
Generally name of classes from Chucker 2.x used to have Chuck
as a prefix (e.g. ChuckInterceptor
). In version 3.x we updated the naming of all the classes to have Chucker
as a prefix (e.g. ChuckerInterceptor
). This is valid for all the classes in the library.
So if to launch the UI of Chucker, you would normally call:
Chuck.getLaunchIntent(...)
now you will call
Chucker.getLaunchIntent(...)
Please note that with version 3.x package name is also updated. The new package for the classes of Chucker will be com.chuckerteam.chucker.api
.
Here a summary of the name/package changes in chucker
Old | New |
---|---|
com.readystatesoftware.chuck.api.Chuck |
com.chuckerteam.chucker.api.Chucker |
com.readystatesoftware.chuck.api.ChuckCollector |
com.chuckerteam.chucker.api.ChuckerCollector |
com.readystatesoftware.chuck.api.ChuckerInterceptor |
com.chuckerteam.chucker.api.ChuckerInterceptor |
Chucker v2.0 used to use a Builder pattern to configure your interceptor. Chucker v3.0 instead is using Kotlin named parameters with default values to configure the interceptor. Multiple builder methods have been removed and you need to replace them with parameters from the constructors.
The following code:
ChuckInterceptor interceptor = new ChuckInterceptor(context, collector)
.maxContentLength(120000L);
should be updated to:
ChuckInterceptor interceptor = new ChuckInterceptor(context, collector, 120000)
We suggest to use Kotlin to configure your interceptor as it makes the code more clean/elegant.
The following code:
val retentionManager = RetentionManager(androidApplication, ChuckCollector.Period.ONE_HOUR)
val collector = ChuckCollector(androidApplication)
.retentionManager(retentionManager)
.showNotification(true)
val interceptor = ChuckInterceptor(context, collector)
.maxContentLength(120000L)
should be updated to:
val collector = ChuckerCollector(
context = this,
showNotification = true,
retentionPeriod = RetentionManager.Period.ONE_HOUR
)
val interceptor = ChuckerInterceptor(
context = context,
collector = collector,
maxContentLength = 120000L
)
You don't need to create a RetentionManager
anymore and you simply have to specify the retentionPeriod
parameter when creating a ChuckerCollector
.
The Period
enum has also been moved from ChuckCollector
to RetentionManager
.
The function Chuck.registerDefaultCrashHanlder
contained a typo in the name and now is moved to Chucker.registerDefaultCrashHandler
.