Avoid NoClassDefFoundError during EventBus registration

There is an obscure scenario causing some older Android versions to throw java.lang.NoClassDefFoundError when trying to register subscribers in EventBus. It was reported often in connection to the class  PersistableBundle, which was introduced in Android API level 21. It seems like an Android bug with reflection, but of course you don’t want your app to crash. Thus, we just added an FAQ entry with covering some background and a couple of solutions. One preferred solution is to update to EventBus 3 along with the subscriber index. Because the index is created during build time, it avoids problematic (and slow) reflection altogether!

Spread the love
Posted in News and tagged , , .