IncompatibleClassChangeError after updating to Android Build Tools 25.1.6 GCM / FCM
I used the gradle dependency tree to solve this error for me.
Just run gradle -q app:dependencies --configuration compile
and check the output for entries like this:
+--- com.mcxiaoke.viewpagerindicator:library:2.4.1
| \--- com.android.support:support-v4:+ -> 24.0.0-beta1 (*)
As Diego Giorgini said this version is too high (>=24).
So update the dependencies in build.gradle
like
compile('com.mcxiaoke.viewpagerindicator:library:2.4.1') {
exclude module: 'support-v4';
}
compile 'com.android.support:support-v4:23.4.0'
Android gcm IncompatibleClassChangeError
Looks like you are using play-services:8.1.0, you should be using 9.0.1, also you should be using the specific play services library eg: play-services-gcm instead of just play-services.
I'd suggest you try firebase-messaging:9.0.1 the implementation is much simpler and it is a superset of the features available in play-services-gcm. See the docs for more.
Error using Push Notification ,java.lang.IncompatibleClassChangeError: android.support.v4.content.ContextCompat Error
**> Got Answer of my question the error is because of using play service
9.0.0
But when we update the play service to 9.4.0 and same as firebase
dependency .and the main issue in my gradle is apply plugin:
'com.google.gms.google-services' will not come at the top of gradle it
will come at the bottom after dependency .And i dont know why this
works fine and my token and context compact issue also got resolved.**
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.mss.plix"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
//====================Add below two line=============
dexOptions {
javaMaxHeapSize "4g" //specify the heap size for the dex process
preDexLibraries = false //delete the already predexed libraries
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
ext {
permissionsDispatcherVersion = '2.1.2'
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.jakewharton:butterknife:7.0.1'
testCompile 'junit:junit:4.12'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.isseiaoki:simplecropview:1.1.4'
compile 'com.github.hotchemi:permissionsdispatcher:2.1.3'
compile 'com.github.aakira:expandable-layout:1.4.1@aar'
compile 'com.github.hotchemi:permissionsdispatcher:2.1.3'
apt "com.github.hotchemi:permissionsdispatcher-processor:2.1.3"
compile project(':library')
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.android.support:design:24.2.0'
compile 'com.android.support:recyclerview-v7:24.2.0'
compile 'com.android.support:cardview-v7:24.2.0'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.android.support:support-v4:24.2.1'
}
apply plugin: 'com.google.gms.google-services'
repositories {
jcenter()
}
it should be like this . :)
Related Topics
Fade in Fade Out Android Animation in Java
Navigation Drawer: How to Set the Selected Item at Startup
What Is the Maximum Amount of Ram an App Can Use
Android Eclipse Ddms - Can't Access Data/Data/ on Phone to Pull Files
Get Center Visible Item of Recycleview When Scrolling
Use Tab with New Toolbar (Appcompat V7-21)
Disable Activity Slide-In Animation When Launching New Activity
Android: Using Linear Gradient as Background Looks Banded
Install_Failed_Duplicate_Permission... C2D_Message
Android - How to Download a File from a Webserver
How to Use Assert on Android Devices
Changing Position of the Dialog on Screen Android
Difference Between Activity and Fragmentactivity
Listing All Extras of an Intent