[Soot-list] Analyzing Android source code with Soot

M Alsob m99m20 at hotmail.com
Wed Feb 5 10:09:15 EST 2014




Hi,I have been trying to include some soot code to analyze android source code- not from a decompiled APK , basically source code before compilation- to get some information about variable definitions and uses,however, it hasn't work with me yet ,  I am encountering problems because of imported android libraries and the R class - I am testing it with a basic hello world source code-I ve read the post about instrumenting Android apps on http://www.bodden.de/2013/01/08/soot-android-instrumentation/ yet the work  I am doing does not involve reading or writing Dalvik bytecode,,
I included android jars from java sdk platforms 17,18, and 19 along with soot, jasmin, polyglot and rt classes in the build path of the project..
the arguments used for the soot.Main call are:List<String> argsList = new ArrayList<String>(Arrays.asList(args));
   argsList.addAll(Arrays.asList(new String[]{
           "-allow-phantom-refs",
           "-w",
           "-soot-class-path",
           "C:/Users/workspace_A/sootTest/src/com/example/soottest",       
            "-output-format",
           "jimple",
           "MainActivity"}some of the errors I am getting:C:\Users\workspace_A\sootTest\src\com\example\soottest\MainActivity.java:3,8:
  Semantic Error: no visible type named android.os.Bundle
C:\Users\workspace_A\sootTest\src\com\example\soottest\MainActivity.java:4,8:
  Semantic Error: no visible type named android.app.Activity
C:\Users\workspace_A\sootTest\src\com\example\soottest\MainActivity.java:5,8:
  Semantic Error: no visible type named android.view.Menu
C:\Users\workspace_A\sootTest\src\com\example\soottest\MainActivity.java:7,35:
  Semantic Error: no visible type named Activity
C:\Users\workspace_A\sootTest\src\com\example\soottest\MainActivity.java:9:
  Semantic Error: method does not override a method from its superclass
C:\Users\workspace_A\sootTest\src\com\example\soottest\MainActivity.java:10,26:
  Semantic Error: no visible type named Bundle
C:\Users\workspace_A\sootTest\src\com\example\soottest\MainActivity.java:12:
  Semantic Error: no method named setContentView(Unknown) in com.example.soottest.MainActivity matches.
C:\Users\workspace_A\sootTest\src\com\example\soottest\MainActivity.java:12,18:
  Semantic Error: R.layout not found
C:\Users\workspace_A\sootTest\src\com\example\soottest\MainActivity.java:12,27:
  Semantic Error: no field named activity_main
C:\Users\workspace_A\sootTest\src\com\example\soottest\MainActivity.java:15:
  Semantic Error: method does not override a method from its superclass
C:\Users\workspace_A\sootTest\src\com\example\soottest\MainActivity.java:16,37:
  Semantic Error: no visible type named Menu
C:\Users\workspace_A\sootTest\src\com\example\soottest\MainActivity.java:18:
  Semantic Error: no method named getMenuInflater() in com.example.soottest.MainActivity matches.
C:\Users\workspace_A\sootTest\src\com\example\soottest\MainActivity.java:18,29:
  Semantic Error: R.menu not found
C:\Users\workspace_A\sootTest\src\com\example\soottest\MainActivity.java:18,36:
  Semantic Error: no field named main
Exception in thread "main" soot.CompilationDeathException: there were errors during parsing and/or type checking (JastAdd frontend)
    at soot.JastAddInitialResolver.formAst(JastAddInitialResolver.java:63)
    at soot.JavaClassSource.resolve(JavaClassSource.java:54)
    at soot.SootResolver.bringToHierarchy(SootResolver.java:215)
    at soot.SootResolver.bringToSignatures(SootResolver.java:239)
    at soot.SootResolver.bringToBodies(SootResolver.java:280)
    at soot.SootResolver.processResolveWorklist(SootResolver.java:150)
    at soot.SootResolver.resolveClass(SootResolver.java:124)
    at soot.Scene.loadClass(Scene.java:448)
    at soot.Scene.loadClassAndSupport(Scene.java:433)
    at soot.Scene.loadNecessaryClass(Scene.java:1053)
    at soot.Scene.loadNecessaryClasses(Scene.java:1067)
    at soot.Main.run(Main.java:167)
    at soot.Main.main(Main.java:141)
    at sootCFG.CallGraphExample.main(CallGraphExample.java:60)Is there a way to tell soot to ignore the imported libraries and the R class??Any recommendation or help would be highly appreciated!!Thanks!!









 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20140205/914e97fc/attachment-0001.html 


More information about the Soot-list mailing list