[Soot-list] Log-statement-insertion into apk file.

H S aras_h1988 at yahoo.com
Sun May 11 18:48:09 EDT 2014


Hi :

I want to add Log statement into an apk file. 

Here is my code:

Scene.v().addBasicClass("android.util.Log",SootClass.SIGNATURES);
SootMethod sm=Scene.v().getMethod(<android.util.Log:inti(java.lang.String,java.lang.String)>");
Value logType = StringConstant.v("INFO");

Value logMessage = StringConstant.v("Inserted Log after show()");
StaticInvokeExpr invokeExpr = Jimple.v().newStaticInvokeExpr(sm.makeRef(), logType, logMessage);
Unit generated = Jimple.v().newInvokeStmt(invokeExpr);

Here is Run-result
Exception in thread "main" java.lang.RuntimeException: tried to get nonexistent method <android.util.Log: int i(java.lang.String,java.lang.String)>
at soot.Scene.getMethod(Scene.java:613)

I also used instead of addBasicClass Method, this following lines:


SootClass logClass = Scene.v().loadClassAndSupport("android.util.Log");
        SootMethod sm = logClass.getMethod("<android.util.Log: int i(java.lang.String,java.lang.String)>");

But I get:
Exception in thread "main" java.lang.RuntimeException: This operation requires resolving level SIGNATURES but android.util.Log is at resolving level HIERARCHY
If you are extending Soot, try to add the following call before calling soot.Main.main(..):
Scene.v().addBasicClass(android.util.Log,SIGNATURES);
Otherwise, try whole-program mode (-w).

I have also added Options.v().set_whole_program(true);
But it wasn't helpful. 

Any suggestion would be appreciated.

Sarah
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20140511/1ccef7ab/attachment-0001.html 


More information about the Soot-list mailing list