How to make two different modules in Android Studio use different versions of the same library via Gradle -


i have 2 modules in android app: app , library. app depends on library

in library want use androidannotations 4.0.0

in app want use androidannotations 3.2.2 because upgrading 4.0.0 require enormous amount of changes, they've changed quite lot, , don't have time right now.

however, ever since upgraded library use androidannotations 4.0.0, usage of androidannotations in app behaves version 4, not version 3, makes me think gradle smart , ignored version 3 app , using version 4 both modules.

how can enforce usage of 2 different versions of dependency in gradle?

enforce use of dependency version on using force command

build.gradle(app):

dependencies {     compile ('com.squareup.okhttp:okhttp:2.4.0') {         force = true     }     ... } 

build.gradle(library):

    dependencies {     compile 'com.squareup.okhttp:okhttp:2.3.0'     ... } 

here excerpt docs if link goes invalid:

allows forcing versions of dependencies, including transitive dependencies. appends new forced modules considered when resolving dependencies.

it accepts following notations:

string in format of: 'group:name:version', example: 'org.gradle:gradle-core:1.0' instance of moduleversionselector collection or array of above automatically flattened 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -