I'm adding StrictMode to my app and it works great until I add a custom ViolationListener.
It seems it cannot find the callback I'm providing and detects that as an error, too.
Could you give me a hand with that?
The following code works just nice:
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
.detectAll()
.penaltyLog()
.build());
The following code does not work:
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
.detectAll()
.penaltyListener(Executors.newSingleThreadExecutor(), new StrictMode.OnVmViolationListener() {
@Override
public void onVmViolation(Violation v) {
//DO MY CUSTOM STUFF LIKE LOG IT TO CRASHLYTICS
Crashlytics.logException(v);
}
})
.penaltyLog()
.build());
This is the logcat reference (Sorry for the Xs. These are covering the package name...)
02-20 19:02:43.682 28793-28793/? W/System: ClassLoader referenced unknown path: /data/app/and.XXXXX.XXXXX.ib.qua-1/lib/arm64
02-20 19:02:43.696 28793-28793/? I/art: Rejecting re-init on previously-failed class java.lang.Class<and.XXXXX.XXXXX.ib.app.MyApp$CrashlyticsViolationListener>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/os/StrictMode$OnVmViolationListener;
Thanks in advance!
BTW: Already did a clean/build/rebuild/disabled instant run....