UPDATE: looked at the 'potential duplicate link', do not get complete answer from there.
thanks for pointing to Using gradle to find dependency tree. But could not get answer from there,
where is this Resolved versions for app (25.4.0) from (why not say Resolved (25.0.1), is there somewhere it can specify the version to be as 'Resolved from')?
is that the only way to inspect the dependency graph to know what the lib/sdk are using? The problem is even if if you find out that but what if you have to use the version you choose, what do you do?
As you mentioned if you force to use the newer version it may cause the lib/sdk not behavior properly.
What is the best/recommended approach?
UPDATE TWO:
tried with the solution suggested in the link:, it still does not work.
However using
configurations.all {
exclude group:"com.android.support", module: "support-v4"
exclude group:"com.android.support", module: "support-annotations"
exclude group:"com.android.support", module: "support-compat"
exclude group:"com.android.support", module: "support-core-utils"
exclude group:"com.android.support", module: "support-core-utils"
}
will compile without error, but the app cant start (crashes inside the lib).
the graph shows:
Information:Gradle tasks [androidDependencies]
Error:\--- com.android.support:support-annotations:25.4.0@jar
Error:+--- com.android.support:support-annotations:25.4.0@jar
Error:\--- com.android.support:support-compat:25.4.0@aar
Error:\--- com.android.support:support-annotations:25.4.0@jar
Error:+--- com.android.support:support-annotations:25.4.0@jar
Error:\--- com.android.support:support-compat:25.4.0@aar
Error:\--- com.android.support:support-annotations:25.4.0@jar
Error:+--- com.android.support:support-annotations:25.4.0@jar
Error:\--- com.android.support:support-compat:25.4.0@aar
Error:\--- com.android.support:support-annotations:25.4.0@jar
Error:\--- com.android.support:support-annotations:25.4.0@jar
Error:+--- com.android.support:support-annotations:25.4.0@jar
Error:\--- com.android.support:support-compat:25.4.0@aar
Error:\--- com.android.support:support-annotations:25.4.0@jar
Error:+--- com.android.support:support-annotations:25.4.0@jar
Error:\--- com.android.support:support-compat:25.4.0@aar
Error:\--- com.android.support:support-annotations:25.4.0@jar
Error:+--- com.google.android.gms:play-services-identity:9.2.1@aar
Error:| +--- com.google.android.gms:play-services-base:9.2.1@aar
Error:| | +--- com.google.android.gms:play-services-basement:9.2.1@aar
Error:| | | \--- com.android.support:support-v4:25.4.0@aar
Error:| | | +--- com.android.support:support-compat:25.4.0@aar
Error:| | | | \--- com.android.support:support-annotations:25.4.0@jar
Error:| | | +--- com.android.support:support-media-compat:25.4.0@aar
Error:| | | | +--- com.android.support:support-annotations:25.4.0@jar
Error:| | | | \--- com.android.support:support-compat:25.4.0@aar
Error:| | | | \--- com.android.support:support-annotations:25.4.0@jar
Error:| | | +--- com.android.support:support-core-utils:25.4.0@aar
Error:| | | | +--- com.android.support:support-annotations:25.4.0@jar
Error:| | | | \--- com.android.support:support-compat:25.4.0@aar
Error:| | | | \--- com.android.support:support-annotations:25.4.0@jar
Error:| | | +--- com.android.support:support-core-ui:25.4.0@aar
Error:| | | | +--- com.android.support:support-annotations:25.4.0@jar
Error:| | | | \--- com.android.support:support-compat:25.4.0@aar
Error:| | | | \--- com.android.support:support-annotations:25.4.0@jar
Error:| | | \--- com.android.support:support-fragment:25.4.0@aar
Error:| | | +--- com.android.support:support-compat:25.4.0@aar
Error:| | | | \--- com.android.support:support-annotations:25.4.0@jar
Error:| | | +--- com.android.support:support-media-compat:25.4.0@aar
Error:| | | | +--- com.android.support:support-annotations:25.4.0@jar
Error:| | | | \--- com.android.support:support-compat:25.4.0@aar
Error:| | | | \--- com.android.support:support-annotations:25.4.0@jar
Error:| | | +--- com.android.support:support-core-ui:25.4.0@aar
Error:| | | | +--- com.android.support:support-annotations:25.4.0@jar
Error:| | | | \--- com.android.support:support-compat:25.4.0@aar
Error:| | | | \--- com.android.support:support-annotations:25.4.0@jar
Error:| | | \--- com.android.support:support-core-utils:25.4.0@aar
Error:| | | +--- com.android.support:support-annotations:25.4.0@jar
Error:| | | \--- com.android.support:support-compat:25.4.0@aar
Error:| | | \--- com.android.support:support-annotations:25.4.0@jar
Error:| | \--- com.google.android.gms:play-services-tasks:9.2.1@aar
Error:| | \--- com.google.android.gms:play-services-basement:9.2.1@aar
Error:| | \--- com.android.support:support-v4:25.4.0@aar
Error:| | +--- com.android.support:support-compat:25.4.0@aar
Error:| | | \--- com.android.support:support-annotations:25.4.0@jar
Error:| | +--- com.android.support:support-media-compat:25.4.0@aar
Error:| | | +--- com.android.support:support-annotations:25.4.0@jar
Error:| | | \--- com.android.support:support-compat:25.4.0@aar
Error:| | | \--- com.android.support:support-annotations:25.4.0@jar
Error:| | +--- com.android.support:support-core-utils:25.4.0@aar
Error:| | | +--- com.android.support:support-annotations:25.4.0@jar
Error:| | | \--- com.android.support:support-compat:25.4.0@aar
Error:| | | \--- com.android.support:support-annotations:25.4.0@jar
Error:| | +--- com.android.support:support-core-ui:25.4.0@aar
Error:| | | +--- com.android.support:support-annotations:25.4.0@jar
Error:| | | \--- com.android.support:support-compat:25.4.0@aar
Error:| | | \--- com.android.support:support-annotations:25.4.0@jar
Error:| | \--- com.android.support:support-fragment:25.4.0@aar
Error:| | +--- com.android.support:support-compat:25.4.0@aar
Error:| | | \--- com.android.support:support-annotations:25.4.0@jar
Error:| | +--- com.android.support:support-media-compat:25.4.0@aar
Error:| | | +--- com.android.support:support-annotations:25.4.0@jar
Error:| | | \--- com.android.support:support-compat:25.4.0@aar
Error:| | | \--- com.android.support:support-annotations:25.4.0@jar
Error:| | +--- com.android.support:support-core-ui:25.4.0@aar
Error:| | | +--- com.android.support:support-annotations:25.4.0@jar
Error:| | | \--- com.android.support:support-compat:25.4.0@aar
Error:| | | \--- com.android.support:support-annotations:25.4.0@jar
Error:| | \--- com.android.support:support-core-utils:25.4.0@aar
Error:| | +--- com.android.support:support-annotations:25.4.0@jar
Error:| | \--- com.android.support:support-compat:25.4.0@aar
Error:| | \--- com.android.support:support-annotations:25.4.0@jar
tried with the suggested solution (without the configurations.all {...}) it still got error:
Warning:Conflict with dependency 'com.android.support:support-media-compat' in project 'helloworldtest'. Resolved versions for app (25.4.0) and test app (25.0.1) differ.
Warning:Conflict with dependency 'com.android.support:support-compat' in project 'helloworldtest'. Resolved versions for app (25.4.0) and test app (25.0.1) differ.
Warning:Conflict with dependency 'com.android.support:support-core-ui' in project 'helloworldtest'. Resolved versions for app (25.4.0) and test app (25.0.1) differ.
Warning:Conflict with dependency 'com.android.support:support-core-utils' in project 'helloworldtest'. Resolved versions for app (25.4.0) and test app (25.0.1) differ.
Warning:Conflict with dependency 'com.android.support:support-v4' in project 'helloworldtest'. Resolved versions for app (25.4.0) and test app (25.0.1) differ.
Warning:Conflict with dependency 'com.android.support:support-fragment' in project 'helloworldtest'. Resolved versions for app (25.4.0) and test app (25.0.1) differ.
Warning:Conflict with dependency 'com.android.support:support-annotations' in project 'helloworldtest'. Resolved versions for app (25.4.0) and test app (25.0.1) differ.
Warning:Conflict with dependency 'com.android.support:support-media-compat' in project 'helloworldtest'. Resolved versions for app (25.4.0) and test app (25.0.1) differ.
Warning:Conflict with dependency 'com.android.support:support-compat' in project 'helloworldtest'. Resolved versions for app (25.4.0) and test app (25.0.1) differ.
Warning:Conflict with dependency 'com.android.support:support-core-ui' in project 'helloworldtest'. Resolved versions for app (25.4.0) and test app (25.0.1) differ.
Warning:Conflict with dependency 'com.android.support:support-core-utils' in project 'helloworldtest'. Resolved versions for app (25.4.0) and test app (25.0.1) differ.
Warning:Conflict with dependency 'com.android.support:support-v4' in project 'helloworldtest'. Resolved versions for app (25.4.0) and test app (25.0.1) differ.
Warning:Conflict with dependency 'com.android.support:support-fragment' in project 'helloworldtest'. Resolved versions for app (25.4.0) and test app (25.0.1) differ.
Warning:Conflict with dependency 'com.android.support:support-annotations' in project 'helloworldtest'. Resolved versions for app (25.4.0) and test app (25.0.1) differ.
the cradle:
configurations.all {
exclude group:"com.android.support", module: "support-v4"
exclude group:"com.android.support", module: "support-annotations"
exclude group:"com.android.support", module: "support-compat"
exclude group:"com.android.support", module: "support-core-utils"
exclude group:"com.android.support", module: "support-core-utils"
}
List ExGroups = [ 'com.android.support' ]
List ExModules = [ 'support-annotations', 'support-compat', 'support-core-utils', 'support-media-compat' ]
dependencies {
testCompile 'junit:junit:4.11'
compile 'com.android.support:support-v4:25.0.1'
// androidTestCompile 'com.android.support:support-v4:25.0.1'
androidTestCompile ('com.android.support:support-v4:25.0.1') {
ExGroups.each { exclude group: '$it' }
ExModules.each { exclude module: '$it' }
}
// androidTestCompile 'com.jayway.android.robotium:robotium-solo:4.3.1'
// androidTestCompile files('libs/android-junit-report-1.5.8.jar')
// // dependencies for uiautomator
// androidTestCompile 'com.android.support.test:runner:0.2'
// androidTestCompile 'com.android.support.test:rules:0.2'
// androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.0'
// after adding this line it got error
//compile 'com.zone.android.identity:account:1.0.0’
compile ('com.zone.android.identity:account:1.0.0){
ExGroups.each { exclude group: '$it' }
ExModules.each { exclude module: '$it' }
}
}
=== initial post:
was testing a lib, before pulling in it the app was just a simple 'hello world' test app. it works fine with the gradle's dependencies. Then added this line for the lib in the gradle's dependencies:
compile 'com.zone.android.data:account:1.0.0’
then it got error:
Conflict with dependency 'com.android.support:support-media-compat' in project 'helloworld'.
Resolved versions for app (25.4.0) and test app (25.0.1) differ.
in the gradle's dependencies, if change theses two lines to 25.4.0 it will be fine.
compile 'com.android.support:support-v4:25.0.1' //<== change to 25.4.0
androidTestCompile 'com.android.support:support-v4:25.0.1' //<== change to 25.4.0
question is where is this Resolved versions for app (25.4.0) from? dont see in the gradle fine has 25.4.0 specified.
why after adding this line: compile 'com.zone.android.data:account:1.0.0’ then it starts to show the error?
If it is caused by this lib com.zone.android.data, could we assume it has specified some different version than our project is using, is that mean we have to use same version as whatever the version the lib/sdk has used (how do we know what version it is using? and what if the lib used some older version and my app would like to use newer version)?
So what is the best practice for including/pulling in lib/sdk if they used different version (or unknown)?
dependencies {
testCompile 'junit:junit:4.11'
compile 'com.android.support:support-v4:25.0.1'
androidTestCompile 'com.android.support:support-v4:25.0.1'
androidTestCompile 'com.jayway.android.robotium:robotium-solo:4.3.1'
androidTestCompile files('libs/android-junit-report-1.5.8.jar')
androidTestCompile 'com.android.support.test:runner:0.2'
androidTestCompile 'com.android.support.test:rules:0.2'
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.0'
// after adding this line it started to get error
compile 'com.zone.android.data:account:1.0.0’
}