New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OkHttp (Okio) conflicts with /system/framework/okhttp.jar on Android L Preview #967
Comments
Are there log messages higher up with a VerifyError?
|
@nfuller Can you configure external/okhttp to jarjar the okio package? Thanks! |
I just see this before the crash: |
I get a similar error with the L preview. I don't understand what @swankjesse means by "configure external/okhttp to jarjar the okio package", but I'd try it. I'm including OkHttp and Okio by: compile 'com.squareup.okhttp:okhttp:2.0.0' I get this stack trace. java.lang.RuntimeException: An error occured while executing doInBackground() |
@swankjesse, not sure if I'm using jarjar in the way you instructed. I created a rules file: rule okio okuhoh I ran jarjar on okhttp and okio: matt_wear$ java -jar jarjar-1.4.jar process jarjarRules okio-1.0.0.jar okuhoh.jar I included the output jars in my project, but same result. |
@parallelcross I was trying to signal to our downstream maintainer in AOSP to use jarjar. If you want to use OkHttp on The L Release then you can either jarjar or proguard. Or wait till it's fixed. |
The android fix for this went into AOSP on May 28th. https://android-review.googlesource.com/#/c/96260/ It just missed the cut. I'll see what needs to happen, if anything, to get it into the next release. Update: Yes - it will be automatically picked up in the next L release. Sorry for the inconvenience until then. |
[Deleted Emanuele Ricci's question by mistake. Apologies.]
The error is because L preview has the okio classes in their original package (okio.*). This means they conflict with the classes being shipped in your APK. Since the ones that ship with the device are used in preference to ones in the APK it fails because the version of the classes you have is newer. In the L release they will be repackaged into com.android.okio (using jarjar). @swankjesse mentioned two options:
|
@nfuller is there a working example for jarjar or proguard repackaging? @parallelcross seems to have difficulties |
Should just be mapping |
@StErMi Sorry, I didn't mean to post that as what works, just as, this is what I have, I've never used jarjar before and would like some help. Got it working though. Thanks. |
retrofit.RetrofitError: Illegal class access: 'okio.Buffer' attempting to access 'okio.SegmentPool' (declaration of 'okio.Buffer' appears in) on Android L preview. |
I created a gradel build file which uses jarjar to map okio to a new namespace. |
I repackaged okio 1.0.0 to Source repos: |
@tommyd3mdi Thanks for the patch man! Finally got rid of that Illegal class access error :) |
@JakeWharton @swankjesse can you provide an OFFICIAL maven release with a patched version of okio / okhttp? (like the one from @tommyd3mdi ... but official) I'm currently using the solution from @bbergler which create a patched version of the library but it has some drawback:
Thanks |
No. It's fixed on Google's side already and the problem only occurs on
|
Here's my version of a workaround which focuses on being no-frills and very straightforward: https://gist.github.com/JakeWharton/017738659d4f38adedc2. |
Thanks for the workaround, i've uploaded the repackaged latest version Okio, okHttp and okHttpUrlConnection to https://gist.github.com/blazmag/c661b6e1ebeb210b4e79 (for someone who's lazy like me and just needs jars) |
Even though it's fixed on Google L side, think the square package should still be updated to com.squareup.okio like in the repackaged version to avoid any potential future conflict with another okio jar. |
We will not be updating the library. |
Please forgive me to kind of hijacking this issue to ask a question, but... Is it expected (normal? documented?) that the classes of a system library have priority over the ones bundled inside an apk? |
BoD, yes it is expected and normal and documented that system classes (from the parent class loader of the application) take priority over those from the app APK: http://developer.android.com/reference/java/lang/ClassLoader.html |
@JakeWharton will okhttp be automatically picked up by Picasso using the "jarjar" solution? and with the "fork" solution? |
Picasso looks for |
Thank you @JakeWharton I could have looked at the code, sorry for asking |
Looks like Google fixed it in the latest L images. |
Yes it was fixed long, long, long ago. We were just waiting for updated images or release which has now happened. |
Thanks for putting up with this and sorry for the inconvenience! |
I have the same issue again
the line where a call createNetworkService
and function looks like this
It looks like the error from head page. |
@petrLorenc: unrelated issue. Chances are you have a different version of a dependency at build time vs. runtime. |
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.squareup.picasso.OkHttpDownloader" on path: DexPathList[[zip file "/data/app/com.developersaifamer2030.friendsstatuspro-1/base.apk", zip file "/data/app/com.developersaifamer2030.friendsstatuspro-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.developersaifamer2030.friendsstatuspro-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.developersaifamer2030.friendsstatuspro-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.developersaifamer2030.friendsstatuspro-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.developersaifamer2030.friendsstatuspro-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.developersaifamer2030.friendsstatuspro-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.developersaifamer2030.friendsstatuspro-1 |
I can't agree any more about you because parent classloader is preference to classloader in apk ,but as you said, it fails because the version of the classes you have is newer. but how program knows which version is newer |
The text was updated successfully, but these errors were encountered: