Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib依赖远程第三方库的jar重复打包 #378

Closed
1 task done
xifan-xf opened this issue Dec 8, 2016 · 4 comments
Closed
1 task done

lib依赖远程第三方库的jar重复打包 #378

xifan-xf opened this issue Dec 8, 2016 · 4 comments

Comments

@xifan-xf
Copy link

xifan-xf commented Dec 8, 2016

  • 我已阅读并理解 贡献指南,严格遵循其约定。

错误报告

你做了什么?

在lib插件包中依赖了远程第三方库(该库属于是jar包分类而非aar,例如fastjson、glide),在宿主中也申明依赖该远程第三方库。

你期望的结果是什么?

第三方库的class只打在宿主中。

实际结果是什么?

产出的lib中包含了第三方库的class文件,没有在transform阶段抽离。

分析:
StripAarTransform这个类中对插件产生dex之前对jarInput没有正确抽离相关三方库的代码,只是抽离了aar类型三方库的代码。

small.splitAars.each {
            splitPaths.add(new File(small.aarDir, "$it.group/$it.name").absolutePath)
  }

目前我的解决办法:
AppPlugin中的hookPreReleaseBuild方法中收集对应的jar包信息,以供transform做抽离判断。

File jar = new File(rootSmall.preLinkJarDir, "$lib.name-D.txt")
@galenlin
Copy link
Member

@XUFAN 这个是说,双方 libs 目录下有同样的 jar 吗?

@xifan-xf
Copy link
Author

是lib或者app中的第三方依赖在expend-aar目录下归类于jar类型 所以没有被剥离

@galenlin
Copy link
Member

ok, any PR refer to this?

@xifan-xf
Copy link
Author

Wrong operating cause cover my first PR about #368...
That fix about aar's so & assets not package in bundle.

galenlin added a commit that referenced this issue Jan 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants