didi / VirtualAPK

A powerful and lightweight plugin framework for Android
Apache License 2.0
8.98k stars 1.52k forks source link

导入第三方混淆后的库,报错ARSE ERROR: class name (com/logic/a) does not match path... #385

Closed Darren-l closed 3 years ago

Darren-l commented 3 years ago

项目中引用了第三方混淆后的库后,执行assmblePlugin后报错: PARSE ERROR: class name (com/tencent/logic/a) does not match path (com/tencent/logic/A.class) ...while parsing com/tencent/logic/A.class

请问,当前框架是不支持混淆后的库吗?

Darren-l commented 3 years ago

解决方式是,将出问题的库放到宿主中编译,而插件在编译的过程中排除掉该库。反正最后dex会合并,宿主和插件只要有一个有引入这个库即可。 具体操作如下:

  1. 在插件的app gradle中加入: configurations { //编译期排除aa模块 compile.exclude module: 'aa' //在整个构建过程中排除aa all*.exclude module: 'aa' }
  2. 在宿主的app gradle中引入aa库。

或者让第三方库打包的时候在混淆配置中去除大小写选项也能解决这个问题。