title: AOP apply Custom Annotation on Overrided Methods
body: <p>I am trying to inject some boilerplate code before a method is called, I have been using AOP for it. </p>
  
  <p>I successfully made one Custom Annotation and now to manage the flow I need to make another and manage the flow. But the Second One throws a NoSuchMethodFound error. I need to annotate an Overrided Method. I tried to annotate a simple method too, but failed to do so. Here's the Aspect Class</p>
  
  <pre><code>@Aspect
  public class AnnotationAspect {
  private static final String TAG = "AnnotationAspect";
  
  private static final String POINTCUT_METHOD =
          "execution(@org.android10.gintonic.annotation.MyAnnotation * *(..))";
  
  @Pointcut(POINTCUT_METHOD)
  public void methodToAnnotate() {
  
  }
  @Around("methodToAnnotate()")
  public Object weaveJoinPoint(ProceedingJoinPoint joinPoint) throws Throwable {
      Log.d(TAG, "weaveJoinPoint: Inside the AnnotationAspect Class");
      joinPoint.proceed();
      return null;
  }
  }
  </code></pre>
  
  <p>Here's the Annotation Class</p>
  
  <pre><code>@Retention(RetentionPolicy.RUNTIME)
  @Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
  public @interface MyAnnotation {
  }
  </code></pre>
  
  <p>And Here's how I am calling it. I also tried the same annotation by calling it on a overrided method like onResume.</p>
  
  <pre><code>@MyAnnotation
  public void myMethod() {
      Toast.makeText(this, "Hello myMethod", Toast.LENGTH_SHORT).show();
  }
  </code></pre>
  
  <p>Here's the link to full GITHUB repository <a href="https://github.com/dhruvins7/CustomAnnotation" rel="nofollow noreferrer">Github</a></p>
  
  <p>The Error block</p>
  
  <pre><code>java.lang.NoSuchMethodError: No static method aspectOf()Lorg/android10/gintonic/aspect/AnnotationAspect; in class Lorg/android10/gintonic/aspect/AnnotationAspect; or its super classes (declaration of 'org.android10.gintonic.aspect.AnnotationAspect' appears in /data/app/android10.org.viewgroupperformance-2/split_lib_slice_9_apk.apk)
               at org.android10.viewgroupperformance.activity.LinearLayoutTestActivity.myMethod(LinearLayoutTestActivity.java:51)
               at org.android10.viewgroupperformance.activity.LinearLayoutTestActivity.onCreate(LinearLayoutTestActivity.java:45)
               at android.app.Activity.performCreate(Activity.java:6582)
               at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113)
               at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2532)
               at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2667)
               at android.app.ActivityThread.-wrap11(ActivityThread.java)
               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1494)
               at android.os.Handler.dispatchMessage(Handler.java:111)
               at android.os.Looper.loop(Looper.java:207)
               at android.app.ActivityThread.main(ActivityThread.java:5776)
               at java.lang.reflect.Method.invoke(Native Method)
               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
  </code></pre>