More on this Exception. I triggered it accidently by quitting and 
relaunching my app quickly and got the following logcat


Application.onCreate() is called
...
08-25 15:41:33.003: WARN/ActivityThread(16118): ClassLoader.loadClass: The 
class loader returned by Thread.getContextClassLoader() may fail for 
processes that host multiple applications. You should explicitly specify a 
context class loader. For example: 
Thread.setContextClassLoader(getClass().getClassLoader());
...
...soon after at init when the first AsyncTask is loaded:
08-25 15:41:39.179: WARN/dalvikvm(16118): Exception 
Ljava/lang/RuntimeException; thrown while initializing 
Landroid/os/AsyncTask;
...
...and boom a bit later:

08-25 15:41:46.152: ERROR/ACRA(16118): java.lang.NoClassDefFoundError: 
android.os.AsyncTask
                             <rest of backtrace>

So the classloader failed to load android.os.AsyncTask from which we are 
warned it may happen from the initial warning.
 I could not find this message anywhere in Android source but I'm using 
CyaonogenMod7.

My app has a Service from another package that is run in the same process 
than the app package. To make the warning disappear about the classloader I 
had
to  add

Thread.currentThread().setContextClassLoader(getClass().getClassLoader());

as the first line of entry point functions of both packages running in the 
same process  (it would still appear if done in one package but not the 
other).

Has anyone a more detailed explanation of this behaviour and if the above 
actually fix it ?








-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to