Home  >  Q&A  >  body text

android - java.lang.IllegalAccessError: Class ref in pre-verified class

  1. 描述你的问题
    java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation

安卓找个错误提示是什么意思吗?有研究过的分享一下吗?
我查看网上的信息,说修改Go to modules -> dependencies, then set scope of the lib to 'Provided'.

但是修改了也还是出错。但是整个程序在真机测试没问题....

  1. 贴上相关代码

  2. 贴上报错信息

    .NativeStart.main(Native Method)
    02-09 20:18:58.763 20941-20941/com.china.chinasix E/dalvikvm: Could not find class 'android.os.PersistableBundle', referenced from method com.china.chinasix.MainActivity.access$super
    02-09 20:18:58.763 20941-20941/com.china.chinasix E/dalvikvm: Could not find class 'android.os.PersistableBundle', referenced from method com.china.chinasix.MainActivity.access$super
    02-09 20:18:58.763 20941-20941/com.china.chinasix E/dalvikvm: Could not find class 'android.media.session.MediaController', referenced from method com.china.chinasix.MainActivity.access$super
    02-09 20:18:58.763 20941-20941/com.china.chinasix E/dalvikvm: Could not find class 'android.widget.Toolbar', referenced from method com.china.chinasix.MainActivity.access$super
    
  3. 贴上相关截图

  4. 已经尝试过哪些方法仍然没解决(附上相关链接)

http://www.4byte.cn/question/836435/java-lang-illegalaccesserror-class-ref-in-preverified-class-resolved-to-unexpected-implementation.html

ringa_leeringa_lee2635 days ago553

reply all(1)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 15:46:41

    这个错误之前我也遇到过,原因应该是你的工程中重复引用了某些类,而且我估计你不是通过静态编译进去的,而是动态加载的dex,然后两个dex中可能包含了同样的一部分代码,还存在互相引用,所以导致dex2中本来有了dex1中的一部分代码,但是却因为冲突没有加载进去,所以引用了dex1中的那部分代码,而这样就会导致这个错误。

    解决方法就是检查一下有没有重复引用某个库,或者某个库包含了另一个之类的情况。

    Reply
    0
  • CancelReply