As this receiver was loaded and instantiated by the default 
PathClassLoader. While in application.onCreate(),we change the default 
PathClassLoader’s  parent classloader to another one(a custom 
HostClassLoader)。Both  PathClassLoader  and HostClassLoader are refer to 
the same apk file。So,when receiver.onReceive() was called,classes(eg, class 
LogCatLog) will be first loaded by HostClassLoader,while this class(eg, 
LogCatLog ) also exist in PathClassLoader.

 

So java.lang.IllegalAccessError: Class ref in pre-verified class resolved 
to unexpected implementation occur.




On Sunday, July 13, 2014 11:29:09 AM UTC+8, shiqun.shi wrote:
>
> Hello,
>
> In my app, we have a receiver, which listens action 
> android.intent.action.PACKAGE_REPLACED. A java.lang.IllegalAccessError: 
> Class ref in pre-verified class resolved to unexpected implementation 
> *occasionally* occur when a new version apk replaced a older one.
>
> The detail message as follows,
>
> java.lang.IllegalAccessError: Class ref in pre-verified class resolved to 
> unexpected implementation
>
> at 
> com.alipay.mobile.appstoreapp.util.PackageReplacedReceiver.onReceive(PackageReplacedReceiver.java:24)
>
> at android.app.ActivityThread.handleReceiver(ActivityThread.java:2525)
>
> at android.app.ActivityThread.access$1600(ActivityThread.java:159)
>
> at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1392)
>
> at android.os.Handler.dispatchMessage(Handler.java:99)
>
> at android.os.Looper.loop(Looper.java:176)
>
> at android.app.ActivityThread.main(ActivityThread.java:5419)
>
> at java.lang.reflect.Method.invokeNative(Native Method)
>
> at java.lang.reflect.Method.invoke(Method.java:525)
>
> at 
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1209)
>
> at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1025)
>
> at dalvik.system.NativeStart.main(Native Method)
>
>  
>
> We debug and trace the android os, and try to reproduce the problem,but 
> failed.
>
> By modify my app,we can reproduce the problem in such situation,where a 
> receiver be instantiated(by cl.loadClass(component).newInstance()) before 
>  packageInfo.makeApplication and application.onCreate().
>
> So please check, is this likely to occur, in some extreme circumstances?
>
> Thanks.
>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to