Run gradle -q dependencies
(or gradle -q :projectName:dependencies
) to generate a dependency report. You should see where r7
is coming from, such as:
compile - Classpath for compiling the main sources. +--- com.commonsware.cwac:camera-v9:0.5.4 | +--- com.actionbarsherlock:actionbarsherlock:4.4.0 | | \--- com.google.android:support-v4:r7 | +--- com.commonsware.cwac:camera:0.5.4 | \--- com.android.support:support-v4:18.0.+ -> 18.0.0 \--- com.android.support:support-v4:18.0.+ -> 18.0.0
Then, use the exclude
directive to block that dependency. In my case, it is coming from my CWAC-Camera library, and so I use:
dependencies { compile('com.commonsware.cwac:camera-v9:0.5.4') { exclude module: 'support-v4' } compile 'com.android.support:support-v4:18.0.+' }
(where the second compile
statement indicates what version you actually want)
That should clear matters up, as you will see if you run the dependency report again:
compile - Classpath for compiling the main sources. +--- com.commonsware.cwac:camera-v9:0.5.4 | +--- com.actionbarsherlock:actionbarsherlock:4.4.0 | \--- com.commonsware.cwac:camera:0.5.4 \--- com.android.support:support-v4:18.0.+ -> 18.0.0