简体   繁体   中英

Gradle exclude classes from aar

Im using lib Gson in my dependecies and im import a.aar with some classes from Gson that are imported to a project. When i build my project i keep getting duplicated classes, bcz its on my dependency and aar classes.

How i can exclude gson classes from aar?

I have been trying with:

  • exclude group: I think this is not work since is not a dependency from aar, but classes inside.
  • transitive true, same reason as before

Can i do it? or should i get other.aar with gson as dependecy?

Usually.aar includes with.pom file which includes all dependency of "aar library" use.

If you are creating own library and use it in another application follow refer the link below. https://medium.com/swlh/android-library-kotlin-creation-access-deploy-problems-fixes-everything-you-want-to-c1a1701f0e8f

Or

Try this following

implementation(name: '××××××× aar package', ext: 'aar') {
    exclude module: 'gson'
}

Let me know if this helpfull

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM