title: frida - hook Android method not work if method called before attach
body: <p>Say app use a button to trigger function call.</p>
  
  <pre><code>    Button btn = new Button(this);
      btn.setText("Test");
      btn.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              hello();
          }
      });
  </code></pre>
  
  <p>The function define:</p>
  
  <pre><code>public int hello() {
      Log.v(TAG,"hello frida!");
      return 0;
  }
  </code></pre>
  
  <p>The script to hook <code>hello</code> API:</p>
  
  <pre><code>Java.perform(function () {
    var clzname = "com.sample.MainActivity";
    var instance = Java.use(clzname);
    instance.hello.overload().implementation = function () {
      console.log("[*] onEnter hello...");
      var retval = this.hello();
      return retval;
    };
  });
  </code></pre>
  
  <p>If launch app, then attach script:</p>
  
  <pre><code>frida -U -l hook.js com.sample
  </code></pre>
  
  <p>it works fine, below log will output:</p>
  
  <pre><code>-&gt; [*] onEnter hello...
  </code></pre>
  
  <p>But if launch app, then click button to trigger the API call firstly, then attach script, it does not work, no output from console.</p>
  
  <p>Does that means if API already being called, then we can not hook it? How to fix my script?</p>