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

多个aar的合并打aar失败 #2

Closed
docwei2050 opened this issue Jan 22, 2019 · 3 comments
Closed

多个aar的合并打aar失败 #2

docwei2050 opened this issue Jan 22, 2019 · 3 comments

Comments

@docwei2050
Copy link

打包失败后,修改里面的libPackageName为aarPackageName,
sb << " public static $type $name = ${aarPackageName}.R.${subclass}.${name};" << '\n'
打包成功,但是在使用打出的fat-aar后,提示资源id找不到。
1.Aaar的activity_a的值是0x7f0f001c,Baar的activity_b的也是0x7f0f001c,合并后,main lib的activity_main的值是0x7f0f001c,,,activity_a的值是0x7f0f001d,,,,activity_b的也是0x7f0f001e,导致资源id找不到。。。

@kezong
Copy link
Owner

kezong commented Jan 22, 2019

不能将libPackageName改为aarPackageName,改了后资源合并就失效了。

能否将修改之前的错误信息发出来,并告知下com.android.tools.build:gradle版本以及gradle的版本。

@docwei2050
Copy link
Author

docwei2050 commented Jan 22, 2019

您这个插件,亲测两个library合成一个aar是没问题。。如果一个library的lib下有个Aaar,那么合并的时候,Aaar的资源id提示找不到符号

Task :blibrary:compileRsDebug FAILED

符号: 变量 layout_behavior
位置: 类 attr
/Users/Mac/Desktop/testaar/testaar/blibrary/build/intermediates/exploded-aar/r/com/paaa/sppppboard/R.java:31: 错误: 找不到符号
public static int layout_dodgeInsetEdges = com.paaa.fcaa.blibrary.R.attr.layout_dodgeInsetEdges;

classpath 'com.android.tools.build:gradle:3.2.1'
distributionUrl=https://services.gradle.org/distributions/gradle-4.6-all.zip

@kezong
Copy link
Owner

kezong commented Jan 23, 2019

如果在一个library的lib下直接放一个aar会有问题,所有需要合并的aar都需要在lib-main中�embed,不然无法合并。建议参考example中的lib-aar-local方式引入本地的aar包,并且如果子library如果需要引用该aar的话可以以compileOnly的形式添加依赖。

@kezong kezong closed this as completed Jul 4, 2019
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