<html><body><div style="color:#000; background-color:#fff; font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:13px"><div id="yui_3_16_0_1_1434745589928_111011">
</div><div class="" dir="ltr" style="" id="yui_3_16_0_1_1434745589928_111033"><span class="" style="">Hi, </span></div><div class="" dir="ltr" style="" id="yui_3_16_0_1_1434745589928_111033"><span class="" style=""><br></span></div><div class="" dir="ltr" style="" id="yui_3_16_0_1_1434745589928_111033"><span class="" style="" id="yui_3_16_0_1_1434745589928_111117">I wanted to insert "Log.d(string s, string g)" statement in side my .</span>dex file , using following code:</div>
<div class="" dir="ltr" style="" id="yui_3_16_0_1_1434745589928_111033"><span class="" style=""><br></span></div><div class="" dir="ltr" style="" id="yui_3_16_0_1_1434745589928_111033"><span class="" style="" id="yui_3_16_0_1_1434745589928_111032">1- SootMethod </span><span class="" style="">toCall3</span><span class="" style="" id="yui_3_16_0_1_1434745589928_111129"> = Scene.v().getSootClass(</span>"android.util.Log"<span class="" style="">).getMethod(</span>"int d(java.lang.String,java.lang.String)"<span class="" style="" id="yui_3_16_0_1_1434745589928_111087">); </span></div><div class="" dir="ltr" style=""><span class="" style="">
</span></div><div class="" dir="ltr" style="" id="yui_3_16_0_1_1434745589928_111048">
</div><div class="" dir="ltr" style="" id="yui_3_16_0_1_1434745589928_111103">
</div><div class="" style=""><span class="" style="">        </span><span class="" style="">        </span></div><div></div><div class="" dir="ltr" style="" id="yui_3_16_0_1_1434745589928_111257"><span class="" style="" id="yui_3_16_0_1_1434745589928_111258">2- b</span>.getUnits().insertBefore(Jimple.v().newInvokeStmt(Jimple.v().newStaticInvokeExpr((SootMethodRef) <span class="" style="">toCall3</span>.makeRef(), <span class="" style="" id="yui_3_16_0_1_1434745589928_111298">tmpLog</span>)) ,<span class="" style="">srcUnit</span>);</div><div class="" dir="ltr" style="" id="yui_3_16_0_1_1434745589928_111103"><br></div><div class="" dir="ltr" style="" id="yui_3_16_0_1_1434745589928_111103">But I got the following error:</div><div class="" style="" id="yui_3_16_0_1_1434745589928_111241">Exception in thread "main" Invalid number of arguments</div><div class="" style="" id="yui_3_16_0_1_1434745589928_111242"><span class="" style="">        </span>at soot.jimple.validation.InvokeArgumentValidator.validate(<span class="" style="" id="yui_3_16_0_1_1434745589928_111321">InvokeArgumentValidator.java:35</span>)</div><div class="" style="" id="yui_3_16_0_1_1434745589928_111218"><span class="" style="">        </span>at soot.jimple.JimpleBody.validate(<span class="" style="" id="yui_3_16_0_1_1434745589928_111278">JimpleBody.java:117</span>)</div><div class="" dir="ltr" style="" id="yui_3_16_0_1_1434745589928_111103">
</div><div class="" dir="ltr" style="" id="yui_3_16_0_1_1434745589928_111192"><span class="" style="">        </span>at soot.jimple.JimpleBody.validate(<span class="" style="" id="yui_3_16_0_1_1434745589928_111191">JimpleBody.java:102</span>)</div><div class="" dir="ltr" style="" id="yui_3_16_0_1_1434745589928_111192"><br></div><div class="" dir="ltr" style="" id="yui_3_16_0_1_1434745589928_111192">I know this error is because Log statement have two input parameters but in the second line of code there is only one parameter is mentioned ("tmpLog"). I do not know how to use "newStaticInvokeExpr" method for inserting methods with more than one argument. I would be appreciated if you could give me an example.</div><div class="" dir="ltr" style="" id="yui_3_16_0_1_1434745589928_111192"><br></div><div class="" dir="ltr" style="" id="yui_3_16_0_1_1434745589928_111192">Best Regards,</div><div class="" dir="ltr" style="" id="yui_3_16_0_1_1434745589928_111192">Marjan </div><div></div><div id="yui_3_16_0_1_1434745589928_111010"> </div><div class="signature" id="yui_3_16_0_1_1434745589928_111008"><div class="yiv9426486400" id="yiv9426486400yui_3_16_0_1_1426188032239_18320" style="font-size:13px;font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;background-color:rgb(255, 255, 255);"><div class="yiv9426486400" id="yiv9426486400yui_3_16_0_1_1426188032239_71660" style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:'Times New Roman', serif;"><br></div></div></div></div></body></html>