我正在尝试在类的构造函数上应用一个方面。我已经创建了一个带有方面的编译类的jar文件。 noq我想将该jar文件转换为.dex文件。但转换它时显示异常:
F:\sachin\Tools\ADT_Bundle\adt-bundle-windows-x86\sdk\platform-tools>dx --dex --
output=classes.dex Yepme_jar_with_aspect_on_setText.jar
EXCEPTION FROM SIMULATION:
local variable type mismatch: attempt to set or access a value of type int using
a local variable of type pak.HookYepmeAspect. This is symptomatic of .class tra
nsformation tools that ignore local variable information.
...at bytecode offset 00000009
locals[0000]: I
locals[0001]: Ljava/lang/String;
locals[0002]: Ljava/lang/String;
locals[0003]: Ljava/lang/String;
locals[0004]: Ljava/lang/String;
locals[0005]: Ljava/lang/String;
locals[0006]: Ljava/lang/String;
locals[0007]: Ljava/lang/String;
locals[0008]: Ljava/lang/String;
locals[0009]: Ljava/lang/String;
locals[000a]: Ljava/lang/String;
locals[000b]: Ljava/lang/String;
locals[000c]: Lorg/aspectj/runtime/internal/AroundClosure;
locals[000d]: <invalid>
stack[0003]: Lorg/aspectj/runtime/internal/AroundClosure;
stack[0002]: [Ljava/lang/Object;
stack[0001]: [Ljava/lang/Object;
stack[top0]: int{0x00000000 / 0}
...while working on block 0007
...while working on method ajc$around$pak_HookYepmeAspect$2$93ff7f29proceed:(ILj
ava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang
/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;
Ljava/lang/String;Ljava/lang/String;Lorg/aspectj/runtime/internal/AroundClosure;
)Ljava/lang/Object;
...while processing ajc$around$pak_HookYepmeAspect$2$93ff7f29proceed (ILjava/lan
g/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String
;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/l
ang/String;Ljava/lang/String;Lorg/aspectj/runtime/internal/AroundClosure;)Ljava/
lang/Object;
...while processing pak/HookYepmeAspect.class
1 error; aborting
这是我的方面代码:
public aspect ABC{
pointcut pkt_findviewbyid(int id):call(View android.app.Activity.findViewById(int)) && args(id);
View around(int id):pkt_findviewbyid(id) && within(com.yepme.*)
{ }
}
我的观察是,每当我将int
参数传递给任何切入点时,都会产生此错误,但我不知道为什么它会像这样。
所以请告诉我这个错误的解决方案是什么...提前谢谢。
答案 0 :(得分:1)
我知道这个回复为时已晚,但它比保持问题没有答案要好。经过大量的研究,我发现带有参数的周围切入点,如果第一个参数是
int
,那么在创建.dex时它会给出错误。因此,为了解决这个问题,我将第一个参数作为目标对象并将其作为目标传递。
void around(Object target, int arg1,String arg2): call(* *.foo(int,String)) && args(arg1,arg2) && target(target)
{
<code body>
}
它对我有用..