Last active
March 10, 2016 16:53
-
-
Save skyler-b/2bfea0b0bbb4ebdb5080 to your computer and use it in GitHub Desktop.
EventBus java.lang.NoClassDefFoundError
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.greenrobot.eventbus.EventBus; | |
import org.greenrobot.eventbus.Subscribe; | |
import android.annotation.TargetApi; | |
import android.os.Build; | |
import android.support.v7.app.AppCompatActivity; | |
import android.webkit.PermissionRequest; | |
public class MainActivity extends AppCompatActivity { | |
@Override | |
public void onStart() { | |
super.onStart(); | |
EventBus.getDefault().register(this); | |
//Alternate, also crashes: | |
//EventBus.builder().ignoreGeneratedIndex(true).build().register(this); | |
} | |
@Subscribe | |
public void onSomeEvent(String something) { | |
} | |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) // This line makes no difference, I just added it for testing | |
public void someMethod(PermissionRequest request) { | |
} | |
@Override | |
public void onStop() { | |
EventBus.getDefault().unregister(this); | |
super.onStop(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment