[Soot-list] Analyzing Android source code with Soot

Bodden, Eric eric.bodden at sit.fraunhofer.de
Mon Feb 10 02:54:25 EST 2014


Hello.

If you analyze an Android project then you need to put the android.jar from the SDK onto Soot's classpath. Otherwise Soot won't find the types that the APK links to, such as android.os.Bundle.

Try adding that.

Cheers,
Eric



On 07.02.2014, at 17:50, M Alsob <m99m20 at hotmail.com> wrote:

> 
> 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!!
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list

--
Prof. Eric Bodden, Ph.D., http://sse.ec-spride.de/ http://bodden.de/
Head of Secure Software Engineering  at Fraunhofer SIT, TU Darmstadt and EC SPRIDE
Tel: +49 6151 16-75422    Fax: +49 6151 16-72051
Room 3.2.14, Mornewegstr. 30, 64293 Darmstadt

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
Url : http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20140210/1bfb8cc0/attachment-0001.bin 


More information about the Soot-list mailing list