gradle dependency error in android

痞子三分冷 提交于 2019-11-27 15:05:48

If you're having a dependency conflict with the v4 support library, you can just exclude it from one of the libraries via the gradle script:

compile ('com.android.support:recyclerview-v7:+') {
    exclude module: 'support-v4'
}
Ultimo_m

I fixed that adding:

compile ('com.facebook.android:facebook-android-sdk:3.22.0@aar'){
    exclude module: 'support-v4'
}
nomongo

Found a solution to this:

  1. Removed the config section in the build.gradle that excludes support-v4

  2. It turns out that .aar files are basically a zip, so removed the support-v4 jar from the dependency .aar library (using 7-zip). And now, I don't get the top-level exception and at the same time able to use recyclerview-v7.

If you are using dependency projects instead of .aar files, try removing the support-v4.jar files in the dependency projects before compiling.

Shouldn't the gradle build tool be intelligent enough to exclude the duplicate packages rather than having the users go thru this kind of workarounds and headaches?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!