Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Class ref in pre-verified class resolved to unexpected implementation #84

Closed
Ashish-Bansal opened this issue Feb 12, 2016 · 7 comments
Closed
Labels

Comments

@Ashish-Bansal
Copy link

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!

@rovo89
Copy link
Owner

rovo89 commented Feb 12, 2016

You get a plus point for using the search function. Too few people use it...

but it didn't help me as it's very much old.

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 the unexpected implementation error.

The solution (for Gradle) is to use provided instead of compile for the Xposed API dependency. Then you only have references to the framework classes, but don't include them in your APK.

@rovo89 rovo89 closed this as completed Feb 12, 2016
@rovo89 rovo89 added the invalid label Feb 12, 2016
@Ashish-Bansal
Copy link
Author

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
Copy link
Owner

rovo89 commented Feb 13, 2016

I guess Dalvik is not able to remove that ambiguity but ART is able to do that

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
Copy link

So this means you cant develop using AIDE (doesnt support provided)

@rovo89
Copy link
Owner

rovo89 commented 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
Copy link

You can. Just extract the jar and delete all the .class files in all directories BUT LEAVE the .java files.

@TheDiamondYT1
Copy link

Then set it to compile

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants