Aviraj Aviraj - 2 months ago 54
Android Question

After updation of gradle issues with dependency

I am limited to use
compileSdkVersion 22
buildToolsVersion "22.0.1"
minSdkVersion 11
targetSdkVersion 15

My project was working fine with gradle version : 2.1.3 and with below dependency :

compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:design:22.2.1'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.android.support:cardview-v7:22.2.1'
compile 'com.prolificinteractive:material-calendarview:1.2.0'
compile 'com.weiwangcn.betterspinner:library-material:1.1.0'
compile 'com.google.android.gms:play-services-appindexing:8.4.0'
compile 'commons-codec:commons-codec:1.10'
compile 'commons-io:commons-io:2.4'


And than, I updated my Android studio gradle latest version and than i found dependency issues in so many places of my project :


java.lang.NoSuchMethodError: No static method
getMatrix(Landroid/view/View;)Landroid/graphics/Matrix; in class
Landroid/support/v4/view/ViewCompat; or its super classes (declaration
of 'android.support.v4.view.ViewCompat' appears in
/data/data/demo.com.android/files/instant-run/dex/slice-com.android.support-support-v4-23.1.1_b118207f54cef84c624be0e78fdf67db32a9749a-classes.dex)
at android.support.v7.widget.RecyclerView$LayoutManager.getTransformedBoundingBox(RecyclerView.java:8097)
at android.support.v7.widget.OrientationHelper$2.getTransformedEndWithDecoration(OrientationHelper.java:402)
at android.support.v7.widget.LinearLayoutManager.recycleViewsFromStart(LinearLayoutManager.java:1275)
at android.support.v7.widget.LinearLayoutManager.recycleByLayoutState(LinearLayoutManager.java:1347)
at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1371)
at android.support.v7.widget.LinearLayoutManager.scrollBy(LinearLayoutManager.java:1193)
at android.support.v7.widget.LinearLayoutManager.scrollVerticallyBy(LinearLayoutManager.java:1043)
at android.support.v7.widget.RecyclerView.scrollByInternal(RecyclerView.java:1596)
at android.support.v7.widget.RecyclerView.onTouchEvent(RecyclerView.java:2704)


Than i downgrade my Gradle version with old one (2.1.3). But still same dependency issues coming in my project. Dependency tree shows below of my project :

+--- com.android.support:appcompat-v7:22.2.1
| \--- com.android.support:support-v4:22.2.1 -> 23.1.1
| \--- com.android.support:support-annotations:23.1.1 -> 24.2.0
+--- com.android.support:design:22.2.1
| +--- com.android.support:appcompat-v7:22.2.1 (*)
| \--- com.android.support:support-v4:22.2.1 -> 23.1.1 (*)
+--- com.android.support:recyclerview-v7:+ -> 24.2.0
| +--- com.android.support:support-compat:24.2.0
| | \--- com.android.support:support-annotations:24.2.0
| +--- com.android.support:support-annotations:24.2.0
| \--- com.android.support:support-core-ui:24.2.0
| \--- com.android.support:support-compat:24.2.0 (*)
+--- com.android.support:cardview-v7:22.2.1
+--- com.prolificinteractive:material-calendarview:1.2.0
| \--- com.android.support:support-v4:23.1.1 (*)
+--- com.weiwangcn.betterspinner:library-material:1.1.0
| +--- com.android.support:appcompat-v7:22.1.1 -> 22.2.1 (*)
| \--- com.rengwuxian.materialedittext:library:2.0.3
| +--- com.android.support:support-annotations:21.0.3 -> 24.2.0
| +--- com.nineoldandroids:library:2.4.0
| \--- com.android.support:appcompat-v7:21.0.3 -> 22.2.1 (*)
+--- com.google.android.gms:play-services-appindexing:8.4.0
| \--- com.google.android.gms:play-services-base:8.4.0
| \--- com.google.android.gms:play-services-basement:8.4.0
| \--- com.android.support:support-v4:23.0.0 -> 23.1.1 (*)
+--- commons-codec:commons-codec:1.10
\--- commons-io:commons-io:2.4


Please help me on this issue

Answer

Why do you use RecyclerView's latest version? Maybe you should indicate the version 22.2.1.

compile 'com.android.support:recyclerview-v7:22.2.1'