title: Frida - NotLoaded Class Hooking - Java.registerClass not working
body: <p>Hy everyone.
  I try to hook an not loaded class on android apk with adb and frida. To do that, I try to load the class include in the dex file, with unusual way. I create a new class with Java.registerClass() to load the original with the implemented targeted class.</p>
  <p>However when I run the code I should to deal with problems :</p>
  <ol>
  <li>Firstly, with the all script I receive this following message :</li>
  </ol>
  <pre><code>{'type': 'error', 'description': &quot;TypeError: cannot read property 'replace' of undefined&quot;, 'stack': &quot;TypeError: cannot read property 'replace' of undefined
      at w (frida/node_modules/frida-java-bridge/lib/types.js:334)
      at registerClass (frida/node_modules/frida-java-bridge/lib/class-factory.js:153)
      at registerClass (frida/node_modules/frida-java-bridge/index.js:271)
      at bend4 (/script1.js:42)
      at &lt;eval&gt; (/script1.js:48)&quot;, 'fileName': 'frida/node_modules/frida-java-bridge/lib/types.js', 'lineNumber': 334, 'columnNumber': 1}
  </code></pre>
  <ol start="2">
  <li>When I run only the first line, system send a refusal for needed permission to do the task. The following refusal :</li>
  </ol>
  <pre><code>{'type': 'error', 'description': 'Error: java.io.IOException: Permission denied', 'stack': 'Error: java.io.IOException: Permission denied
      at &lt;anonymous&gt; (frida/node_modules/frida-java-bridge/lib/env.js:124)
      at value (frida/node_modules/frida-java-bridge/lib/class-factory.js:1058)
      at e (frida/node_modules/frida-java-bridge/lib/class-factory.js:580)
      at apply (native)
      at value (frida/node_modules/frida-java-bridge/lib/class-factory.js:963)
      at e (frida/node_modules/frida-java-bridge/lib/class-factory.js:547)
      at ue (frida/node_modules/frida-java-bridge/lib/class-factory.js:1190)
      at fromBuffer (frida/node_modules/frida-java-bridge/lib/class-factory.js:1168)
      at registerClass (frida/node_modules/frida-java-bridge/lib/class-factory.js:216)
      at registerClass (frida/node_modules/frida-java-bridge/index.js:271)
      at bend4 (/script1.js:42)
      at &lt;eval&gt; (/script1.js:48)', 'fileName': 'frida/node_modules/frida-java-bridge/lib/env.js', 'lineNumber': 124, 'columnNumber': 1}
  </code></pre>
  <p>I specify I run the hook with root privilege on Android VM based on virtualbox devices.</p>
  <p>The hook script :</p>
  <pre><code>function bend4(){
      const p2 = Java.registerClass({
  
          name:&quot;com.example.orl&quot;,
          // implements: [],
          // superClass: targeted_class,
  
      });
  
      const p3 = p2.$new();
      send(p3);
  };
  Java.perform(bend4());
  </code></pre>
  <p>Thank you in advance for your help.</p>