I want to use google gcm in my app, but I meet the java.lang.IncompatibleClassChangeError
when call XXXFragment.class
, and this problem just happens on android 5.0+(My samsung note3 with cm12-android 5.1). It does not happen in my another phone with android 4.4.4 and an emulator with android 4.4.4. The answer in this question point that the version of support v4 is higher than 24 may cause this problem, but this doesn't exist in my project.
Below is the dependencies in build.gradle
:
compile ('com.google.android.gms:play-services-gcm:9.0.2') {
exclude module: 'support-v4'
exclude module: 'support-annotations'
}
So why this happens?
Update This problem does not happens on samsung s6 with android 5.1.1 as well.