Okhttp Noclassdeffounderror
Solution 1:
OkHttp v2.0 depends on Okio v1.0. You can download its jar here. This worked for me
Reference from https://github.com/square/okhttp/issues/870
Solution 2:
In OkHttp 2.0.0 the language level was updated to Java 7.
See Change log here https://github.com/square/okhttp/blob/master/CHANGELOG.md
In order to fix the issue you will need to update to java 7.
Also at this point you may also need change the target sdk to kitkat (API 19), and update your build tools etc in order for android to play nice with java 7
EDIT: I had the same problem when i upgraded to okHttp 2.0.0 and built with ant. Although the build seemed to succeed i got the NoClassDefFoundError. Going through my build logs I had a whole bunch of silent errors
The first came from javac
warning: com/squareup/okhttp/<classname>.class major version 51is newer than 50, the highest major version supported bythis compiler.
and the second from dex
[dx] trouble processing:
[dx] bad class file magic (cafebabe) orversion (0033.0000)
[dx] ...while parsing com/squareup/okhttp/<classname>.class
[dx] ...while processing com/squareup/okhttp/<classname>.class
Solution 3:
Go to Project/Properties/Java Build Path/Order and Export
-- Make sure there's a check in front of Android Dependencies and the support library, if you use it. Mark all checkboxes and Click on Apply and clean the project.
Post a Comment for "Okhttp Noclassdeffounderror"