Deepak
Deepak

Reputation: 1397

Use AspectJ in an android library project

I want to try and use AspectJ as part of an android library project. I tried creating an android library project and used annotation based style to create pointcuts.

The problem is that the aspects of the library project does not get weaved into the android application which has added my library project.

My Android library project has few aspects defined in it. Something like

@AfterReturning(pointcut = "execution(* *.*(..)) && !this(com.xyz.aspects.xyz)")
public void abc(JoinPoint jp) 
{ 
    dosomething;
}

I've added this library project to my android application. However the 'dosomething' is not executed. Any advices?

Upvotes: 2

Views: 766

Answers (2)

Deepak
Deepak

Reputation: 1397

Finally fixed this. I added the library project to my aspect path and things started to work.

Upvotes: 3

kriegaex
kriegaex

Reputation: 67297

How about

execution(* *(..)) && !within(com.xyz.aspects.xyz..*)

I have not tested it, just quickly written it with my iPad, but maybe it helps. Keep me updated if it does not.

Upvotes: 1

Related Questions