OAuth in Android application

时光总嘲笑我的痴心妄想 提交于 2019-12-01 12:54:29

The support-v4 transitive dependency is being added twice. You can verify it using either dependencies task or dependency insight report:

MacBook-Pro:demo alex$ ./gradlew app:dependencies --configuration compile

or:

MacBook-Pro:demo alex$ ./gradlew app:dependencyInsight --configuration compile --dependency support-v4

Where demo is the root directory of your project. The output for compile configuration will be:

compile - Classpath for compiling the main sources.
+--- com.android.support:appcompat-v7:21.0.0
|    \--- com.android.support:support-v4:21.0.0
|         \--- com.android.support:support-annotations:21.0.0
\--- com.wu-man:android-oauth-client:0.0.3
     +--- com.google.oauth-client:google-oauth-client-java6:1.15.0-rc
     |    \--- com.google.oauth-client:google-oauth-client:1.15.0-rc
     |         +--- com.google.http-client:google-http-client:1.15.0-rc
     |         |    \--- com.google.code.findbugs:jsr305:1.3.9
     |         \--- com.google.code.findbugs:jsr305:1.3.9
     +--- com.google.http-client:google-http-client-jackson:1.15.0-rc
     |    +--- com.google.http-client:google-http-client:1.15.0-rc (*)
     |    \--- org.codehaus.jackson:jackson-core-asl:1.9.11
     +--- com.google.android:support-v4:r7
     \--- com.google.api-client:google-api-client-android:1.15.0-rc
          +--- com.google.api-client:google-api-client:1.15.0-rc
          |    \--- com.google.oauth-client:google-oauth-client:1.15.0-rc (*)
          \--- com.google.http-client:google-http-client-android:1.15.0-rc
               \--- com.google.http-client:google-http-client:1.15.0-rc (*)

And the output of dependency insight report will be:

:app:dependencyInsight
com.android.support:support-v4:21.0.0
\--- com.android.support:appcompat-v7:21.0.0
     \--- compile

com.google.android:support-v4:r7
\--- com.wu-man:android-oauth-client:0.0.3
     \--- compile


Note that both appcompat-v7 and android-oauth-client depend on support-v4. You can easily solve it by excluding the android-oauth-client's dependency:

dependencies {
    compile 'com.android.support:appcompat-v7:21.0.0'
    compile ('com.wu-man:android-oauth-client:0.0.3') {
        exclude group: 'com.google.android', module: 'support-v4'
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!