Class ref in pre-verified class resolved to unexpected implementation #84
Description
Hi everyone,
I have created an xposed module and one user is experiencing this error :
Loading modules from /data/app/com.phantom.onetapyoutubemodule-1.apk Loading class com.phantom.onetapyoutubemodule.YoutubeMediaHook java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation at dalvik.system.DexFile.defineClass(Native Method) at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:211) at dalvik.system.DexPathList.findClass(DexPathList.java:313) at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:51) at java.lang.ClassLoader.loadClass(ClassLoader.java:501) at java.lang.ClassLoader.loadClass(ClassLoader.java:461) at de.robv.android.xposed.XposedBridge.loadModule(XposedBridge.java:421) at de.robv.android.xposed.XposedBridge.loadModules(XposedBridge.java:386) at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:120) at dalvik.system.NativeStart.main(Native Method)
(full log at http://ix.io/olo)
I found one old post on XDA forums regarding this issue :
http://forum.xda-developers.com/showpost.php?p=48498627&postcount=6877
but it didn't help me as it's very much old.
The problem is only one user is getting this error and other modules are working for him (Check the full log link).
Does anyone knows the reason ?
Thanks!
Activity
rovo89 commentedon Feb 12, 2016
You get a plus point for using the search function. Too few people use it...
Old doesn't mean incorrect. ;) It's still the correct answer. You have compiled the Xposed API into your module's APK. So e.g. the
XposedBridge
class comes with your APK and the installed Xposed framework. When resolving references to this class, it's not clear which of the two is meant - hence theunexpected implementation
error.The solution (for Gradle) is to use
provided
instead ofcompile
for the Xposed API dependency. Then you only have references to the framework classes, but don't include them in your APK.Ashish-Bansal commentedon Feb 13, 2016
Yeah, you are right, I compiled the Xposed Bridge into my module's APK.
I guess Dalvik is not able to remove that ambiguity but ART is able to do that(as I was using ART and it was working for me).
I checked source code of other modules which loaded fine according to logs. I wonder how those modules are working.
e.g. https://github.com/pylerSM/YouTubeBackgroundPlayback/blob/master/build.gradle#L43
Anyway, Thanks :)
rovo89 commentedon Feb 13, 2016
Possible. It might be because under Dalvik, dexopt doesn't know anything about XposedBridge, but dex2oat under ART might know some things. Nevertheless, the API should never be compiled into modules.
TheDiamondYT1 commentedon Jan 12, 2017
So this means you cant develop using AIDE (doesnt support provided)
rovo89 commentedon Jan 13, 2017
It there's no way to say that the classes will be there on the device, but must not be packaged in the APK, then yes, you can't use that IDE.
TheDiamondYT1 commentedon Jan 13, 2017
You can. Just extract the jar and delete all the .class files in all directories BUT LEAVE the .java files.
TheDiamondYT1 commentedon Jan 13, 2017
Then set it to compile