[Soot-list] Soot not able to process the source code of android applications

Sanjay Thakur sttsanjay at gmail.com
Fri Jun 12 18:59:17 EDT 2015


Hello all,
I have been trying to analyze the source code of Android applications. The
soot is not able to reference and process the non-java components (which
are actually the xml components) like the TextView and the layout file. I
have tried using the exclude list with "R." but got no success. Here is my
sample code:

Options.v().set_android_jars(pathToAndroidJarForSoot);
Options.v().set_soot_classpath("/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/rt.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/jce.jar:/home/sanjay/Android/Sdk/platforms/android-21/android.jar");
Options.v().set_src_prec(Options.src_prec_java);
Options.v().set_allow_phantom_refs(true);
List<String> excludeList = new LinkedList<String>();
excludeList.add("R.");
Options.v().set_exclude(excludeList);
Options.v().set_no_bodies_for_excluded(true);
Options.v().set_process_dir(Collections.singletonList(pathToDirectory));
Options.v().set_whole_program(true);
......
......



The errors look like the following
/home/sanjay/Documents/UQAM/sourcesNapks/ForSoot/app/src/main/java/forsoot/com/forsoot/MainActivity.java:17,24:
soot.CompilationDeathException: there were errors during parsing and/or
type checking (JastAdd frontend)
  Semantic Error: R.layout not found
at soot.JastAddInitialResolver.formAst(JastAddInitialResolver.java:63)
/home/sanjay/Documents/UQAM/sourcesNapks/ForSoot/app/src/main/java/forsoot/com/forsoot/MainActivity.java:17,33:
at soot.JavaClassSource.resolve(JavaClassSource.java:54)
  Semantic Error: no field named activity_main is accessible
at soot.SootResolver.bringToHierarchy(SootResolver.java:230)
/home/sanjay/Documents/UQAM/sourcesNapks/ForSoot/app/src/main/java/forsoot/com/forsoot/MainActivity.java:18,43:
at soot.SootResolver.bringToSignatures(SootResolver.java:255)
  Semantic Error: R.id not found
at soot.SootResolver.bringToBodies(SootResolver.java:291)
/home/sanjay/Documents/UQAM/sourcesNapks/ForSoot/app/src/main/java/forsoot/com/forsoot/MainActivity.java:18,48:
at soot.SootResolver.processResolveWorklist(SootResolver.java:165)
  Semantic Error: no field named tvMessage is accessible
at soot.SootResolver.resolveClass(SootResolver.java:130)
/home/sanjay/Documents/UQAM/sourcesNapks/ForSoot/app/src/main/java/forsoot/com/forsoot/MainActivity.java:26,35:
at soot.Scene.loadClass(Scene.java:693)
  Semantic Error: R.menu not found
at soot.Scene.loadClassAndSupport(Scene.java:678)
/home/sanjay/Documents/UQAM/sourcesNapks/ForSoot/app/src/main/java/forsoot/com/forsoot/MainActivity.java:26,42:
at soot.Scene.loadNecessaryClasses(Scene.java:1351)
  Semantic Error: no field named menu_main is accessible
at paprika.analyzer.SootAnalyzer.init(SootAnalyzer.java:82)
/home/sanjay/Documents/UQAM/sourcesNapks/ForSoot/app/src/main/java/forsoot/com/forsoot/MainActivity.java:38,19:
at paprika.Main.runAnalysis(Main.java:112)
  Semantic Error: R.id not found
at paprika.Main.main(Main.java:79)
/home/sanjay/Documents/UQAM/sourcesNapks/ForSoot/app/src/main/java/forsoot/com/forsoot/MainActivity.java:38,24:
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  Semantic Error: no field named action_settings is accessible
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)

-- 
Sanjay Thakur
Research Intern
UQAM
Montreal, Canada
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20150612/5767e81b/attachment.html 


More information about the Soot-list mailing list