Skip to content
This repository has been archived by the owner on Feb 21, 2021. It is now read-only.

项目中如果有使用AIDL方式的进程间通信的功能会报错 #2

Open
loseashell opened this issue Jun 11, 2016 · 3 comments

Comments

@loseashell
Copy link

loseashell commented Jun 11, 2016

AndroidStudio 2.1.1
Gradle Version 2.10
Android Plugin Version 2.1.0
项目中如果有使用AIDL方式的进程间通信的功能会报错,编译项目时没有混淆,没有自动打包,使用的是这个阶段的方式:Android热补丁动态修复技术(三)—— 使用Javassist注入字节码,完成热补丁框架雏形(可使用) ,打印信息如下:
================injectClass!==========com.test.myapplication.ITestAidlInterface$Stub$Proxy
================injectClass!==========com.test.myapplication.ITestAidlInterface$Stub
================injectClass!==========com.test.myapplication.ITestAidlInterface
Error:Execution failed for task ':TestDemo:transformClassesWithPreDexForDebug'.

0

其中ITestAidlInterface 是AIDL自动生成的class,Stub 和Proxy 是 ITestAidlInterface 的内部类

@aitsuki
Copy link
Owner

aitsuki commented Jun 11, 2016

这个是因为javassist没有引入IBinder这个类的library,这个步骤中我并没有添加android.jar到javassist中。
github上这个项目能运行么

@loseashell
Copy link
Author

刚刚找到原因了,ITestAidlInterface 是接口,接口是没有构造函数的,所有不能在构造函数注入,在Inject.groovy—>private static void injectClass(String className, String path) 方法添加一句代码
if( c.isInterface()) {
return
}
这样就可以编译通过了

@aitsuki
Copy link
Owner

aitsuki commented Jun 11, 2016

原来如此,感谢啦

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants