luckybilly / CC

业界首个支持渐进式组件化改造的Android组件化开源框架,支持跨进程调用。Componentize your android project gradually.
https://luckybilly.github.io/CC-website/
Apache License 2.0
4.04k stars 636 forks source link

插件问题? #62

Closed shingohu closed 6 years ago

shingohu commented 6 years ago

Unexpected scopes found in folder '/Users/xx/MEGA/AndroidStudio/CC/demo_component_b/build/intermediates/transforms/mergeJniLibs/debug'. Required: PROJECT. Found: EXTERNAL_LIBRARIES, PROJECT, SUB_PROJECTS

重现步骤,使用demo,在demo_base中引入一个包含.so的库如:com.bugtags.library:bugtags-lib:3.0.0 1.运行demo_component_b正常 2.切换运行demo爆出上面异常

https://blog.csdn.net/fengrui_sd/article/details/78658103 这里面有说到

luckybilly commented 6 years ago

问题大致定位到了,应该是:

  1. 组件module以application编译运行后,3.0版以上的gradle在transforms/mergeJniLibs目录下生成了一个 __content__.json文件,其中记录了组件module在以application方式编译时的scope值 image

image

  1. 在打主app包时,组件module应该是作为library来编译的,gradle3.0认为它的scope应该只有project,但在读取这个__content__.json时发现与预期的不一致,于是报错

注:这个问题是2.0版优化组件切换运行模式的方式时出现的,1.x版本在local.properties中切换运行方式后需要sync / clean后才能单独编译运行,clean后组件module中的编译缓存会被清除,所以不会出现这个问题

后面我来想想怎么解决,在我解决之前,可以先用以下方式来避免这个问题:

  1. 先在local.properties中添加modulename=true,标记单独运行的组件
  2. 再运行主app
  3. 最后再运行单独运行的组件module

这个反馈很有用,也很及时,非常感谢!

luckybilly commented 6 years ago

@shingohu cc-register 1.0.1版已修复

shingohu commented 6 years ago

@luckybilly 报错的位置换了个地方 Unexpected scopes found in folder '/Users/hujie/MEGA/AndroidStudio/CCProject/loginmodule/build/intermediates/transforms/stripDebugSymbol/debug'. Required: PROJECT. Found: EXTERNAL_LIBRARIES, PROJECT, SUB_PROJECTS

shingohu commented 6 years ago

最新cc-register 1.0.2版本已修复上面提到的两个问题