-
Notifications
You must be signed in to change notification settings - Fork 641
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
一种安全的替换 fat-aar-android 插件的方法 #416
Comments
Did you find a solution? |
Thank you, I think I can try it |
Unfortunately, it has a problem. The Java file generated by the sub -Module Aidl file seems to produce two copies. It is prompted to repeat. 可惜, 它存在一个问题, 子Module的AIDL文件生成的java文件, 似乎会产出两份, 提示类重复. |
if it works, then it is not a problem. just a warning. |
|
有办法把依赖的三方库也合并到aar中吗? |
@dyguests |
引用的模块, 只能被一个模块引用 |
@kapaseker 对于generated的Java Class好像无法include进来,比如DataBinding生成的Class,虽然layout能被包含进来,但是layout的生成类貌似不会,有经验或者思路吗 |
解决了,还顺便处理了manifest project.android {
sourceSets {
val sourceDirs = mutableListOf<String>()
val kotlinSourceDirs = mutableListOf<String>()
val aidlDirs = mutableListOf<String>()
val resDirs = mutableListOf<String>()
val assetsDirs = mutableListOf<String>()
val jniDirs = mutableListOf<String>()
moduleList.forEach { module ->
sourceDirs.add("${module.projectDir.absolutePath}/src/main/java")
kotlinSourceDirs.add("${module.projectDir.absolutePath}/src/main/kotlin")
sourceDirs.add("${module.projectDir.absolutePath}/build/generated/source/buildConfig/$variant")
sourceDirs.add("${module.projectDir.absolutePath}/build/generated/ap_generated_sources/$variant/out")
sourceDirs.add("${module.projectDir.absolutePath}/build/generated/data_binding_base_class_source_out/$variant/out")
sourceDirs.add("${module.projectDir.absolutePath}/build/generated/data_binding_trigger/$variant")
aidlDirs.add("${module.projectDir.absolutePath}/src/main/aidl")
resDirs.add("${module.projectDir.absolutePath}/src/main/res")
assetsDirs.add("${module.projectDir.absolutePath}/src/main/assets")
jniDirs.add("${module.projectDir.absolutePath}/src/main/jniLibs")
val manifestFile = "${module.projectDir.absolutePath}/src/main/AndroidManifest.xml"
this[variant].manifest.srcFile(manifestFile)
}
this[variant].apply {
java.srcDirs(sourceDirs)
kotlin.srcDirs(kotlinSourceDirs)
aidl.srcDirs(aidlDirs)
res.srcDirs(resDirs)
assets.srcDirs(assetsDirs)
jniLibs.srcDirs(jniDirs)
}
}
} |
这个脚本的总体思路就是,把需要打包的源码,源资源,所有能包含的都包含进行,思路就是这么个思路,如果有别的代码没有包含进来,就找到这个源码路径在哪里,包含进来就行了。 |
fat-aar-android不再更新带来的问题
目前遇到两个比较麻烦的点:
解决方案
完全依赖Gradle进行多Module打包:
The text was updated successfully, but these errors were encountered: