I am trying to configure AspectJ in Android Studio.
But after all trial and error its not working ! Surprisingly I am able to make it work with Eclipse Kepler version
The steps I followed for Android Studio
- Created sample
AndroidProject - File > Settings > searched for
AspectJin Plugin section
- Assuming nothing more to be done in Studio , except configuration of build.gradle files
- Added
compile 'org.aspectj:aspectjrt:1.8.1'to the to the build.gradle (Module:app) - Created
Analytics_onBackPressed.ajfor back button press detection - Created
Analytics_OnClick.ajfor click events detection - Created
Analytics_onCreate.ajfor components oncreate event detection - Created necessary dependency classes which the above mentioned
*.ajclasses will internally call - Added required permissions in Manifest
- Running the project is not detecting any of the events (button click, oncreate or back button click)
- Followed these links ReferenceLinkOne , ReferenceLinkTwo and ReferenceLinkThree
My Question is what is more required to make AspectJ working with Android Studio
Steps followed in Eclipse and got AspectJ working
- Downloaded
EclipseKepler version - Through Install New Software option searched for http://download.eclipse.org/tools/ajdt/43/update
- Installed
AspectJ Development Tools (Required). - Created sample android project
- Created
Analytics_onBackPressed.ajfor back button press detection - Created
Analytics_OnClick.ajfor click events detection - Created
Analytics_onCreate.ajfor components oncreate event detection - Added required permissions in Manifest File
- Right clicked in project and converted project to AspectJ by the following

- Configured Java build path with AspectJ runtime library
- Now while running the project, I am able to detect components oncreate, back button press
Environment Used
Android Studio : 2.1.2
JRE : 1.8.0
Windows 7 Enterprise
Any help is highly appreciated!
EDIT : 1 , From the output , still AspectJ is not properly configured
As per this link , I created jar file from eclipse including *.aj files and corresponding dependency. Excluded AndroidManifest.xml while creating jar file and created jar
Created Project in Android Studio. Placed this *.jar file in libs file. (apps> libs). I have enabled AspectJ waving as shown below

Now searched the properties for AspectJ and enabled
Now running the project, should be creating logs I had put in *.aj files which is in plugin . Unfortunately these logs are not printed in Android Studio logs.
Form which I am concluding still AspectJ is not enabled in this project OR there is a configuration error