You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 30, 2019. It is now read-only.
Android apps that safely use new API classes as parameters in a method will still crash due to the following line in AnnotatedMethodHandler:
for (Method method : listenerClass.getDeclaredMethods())
An example set of methods:
@TargetApi(19)
private void doANewThingIfPossible() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
CaptioningManager captioningManager = (CaptioningManager) getActivity().getSystemService(Context.CAPTIONING_SERVICE);
doANewThingWithCaptioning(captioningManager);
}
@TargetApi(19)
private void doANewThingWithCaptioning(CaptioningManager mgr) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
// Do something with captioning
}
}
A class with these methods is safe to run on an older device without Otto, but attempting to register this class to an Otto Bus will cause the class to crash with a java.lang.NoClassDefFoundError: android/view/accessibility/CaptioningManager upon registration.
There are definitely work-arounds and good coding practices that will prevent this, like inlining or moving doANewThingWithCaptioning to a new class, but wanted to bring it up as adding Otto to a pre-existing class can cause this to crop up.