I am trying to apply an aspect on constructor of a class.I have created a jar file of compiled class with aspect. noq i want to convert that jar file to .dex file . But while converting it shows me exception:
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
This is my aspect code:
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.*)
{ }
}
My observation is that whenever i pass int
argument to to any pointcut, this error is generated, but i don't know why it behaves like this .
so please tell me what can be the solution for this error ...Thanks in advance . .
I know that this reply is too late, but its better than keeping question as unanswered. After a lot of research i found that the around pointcut that takes arguments and if first argument is
int
then while creating .dex it gives error. So to resolve this i took first argument as target Object and passed it as a target.
void around(Object target, int arg1,String arg2): call(* *.foo(int,String)) && args(arg1,arg2) && target(target)
{
<code body>
}
and it worked for me..