꿈소년의 개발 이야기

java.lang.incompatibleclasschangeerror android.support.v4.content.contextcompat 본문

Android Development

java.lang.incompatibleclasschangeerror android.support.v4.content.contextcompat

꿈소년 2016. 9. 23. 13:44
반응형

Android Studio is upgrade to version 2.2 from 2.1.x.

But it happened critical problem for Authorization of Google SDK.

below statement is printed by studio.

" java.lang.incompatibleclasschangeerror android.support.v4.content.contextcompat "


It means that android support library v4 is not incompatible with another class. 

I don't know how to solve it. so I just googling and find out it's solution.


configuration.all {

resolutionStrategy {

force 'com.android.support:support-v4:23.3.0

}

}


Why it so happen ?? Because android gradle plugin updated to new version 2.2.0 from 2.1.3. 

New android gradle plugin is not supported dynamic dependency in version name. Like '+' version name means that is only newer version.

If plugin detect '+' version name , it will modify version name to newer. and it effect all of module in the project.


If you are using dynamic dependency like version name '+' , so you will be show the error log about Google like SDK or GMS.

also other open-source libraries don't know about this issue and don't fix it. 

If you are using a lot of libraries in android, You will be check them all about using android support library v4 version.

[Reference]

https://developer.android.com/studio/releases/gradle-plugin.html

http://stackoverflow.com/questions/37312340/incompatibleclasschangeerror-after-updating-to-android-build-tools-25-1-6-gcm

http://stackoverflow.com/questions/37337393/android-google-cloud-messaging-gcm-token-generation-crash-after-firebase-relat