Tracking loading of classes in android.

32 views
Skip to first unread message

Sunny

unread,
Oct 2, 2012, 3:49:20 PM10/2/12
to android...@googlegroups.com

Hi all,

I am trying to track loading of classes in memory. Which all classes are going to load in android. I searched on net and i found java.lang.ClassLoader class which contain loadClass() function to load class in memory. To monitor loading of classes i am thought to use Log.java class which have function for log. i.e Log.I( ___, __ ) function.

Now, Location of source code of this ClassLoader.java is myandroid_source_code_dir/libcore/luni/src/main/java/java/lang/ClassLoader.java    &
Location of source code of Log.java is myandroid_source_code_dir/frameworks/base/core/java/android/util/Log.java

I checked in some other file which was using Log.java class and they import it by "android.util.Log". So i did same thing in ClassLoader.java. I added "import android.util.log" and used Log.i()  function.

But when i compiled it i got following error.

**********

libcore/luni/src/main/java/java/lang/ClassLoader.java:48: package android.util does not exist
import android.util.Log;
                   ^
libcore/luni/src/main/java/java/lang/ClassLoader.java:48: package android.util does not exist
import android.util.Log;
                   ^
libcore/luni/src/main/java/java/lang/ClassLoader.java:229: cannot find symbol
symbol  : variable Log
location: class java.lang.ClassLoader
Log.i("DefiningClass", "Class is defined by its memory image.");
^

**********

Can any one tell me how to added it. Or may be some other ways to monitor loading of classes.

Thanks,

Reply all
Reply to author
Forward
0 new messages