3

I have included okhttp3 and tested PATCH and DELETE methods in android versions less than LOLLIPOP (api 21). I did not include Okio and it worked fine. But, in the okhttp site they mention the following:

You'll also need Okio, which OkHttp uses for fast I/O and resizable buffers. Download the latest JAR.

Could anyone please confirm if Okio can be safely ignored to use OkHttp?

Additional info: I saw the same warning logs with and without okio 1.14.0 in Android 4.1.2 Samsung Galaxy Note while making a PATCH call with OkHttp 3.10.0.

03-02 14:18:39.850 6123-6159/ W/dalvikvm: VFY: unable to find class referenced in signature (Ljava/nio/file/Path;) 03-02 14:18:39.850 6123-6159/ W/dalvikvm: VFY: unable to find class referenced in signature ([Ljava/nio/file/OpenOption;) 03-02 14:18:39.850 6123-6159/ I/dalvikvm: Could not find method java.nio.file.Files.newOutputStream, referenced from method okio.Okio.sink 03-02 14:18:39.855 6123-6159/ W/dalvikvm: VFY: unable to resolve static method 30883: Ljava/nio/file/Files;.newOutputStream (Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Ljava/io/OutputStream; 03-02 14:18:39.855 6123-6159/ D/dalvikvm: VFY: replacing opcode 0x71 at 0x000b 03-02 14:18:39.860 6123-6159/ W/dalvikvm: VFY: unable to find class referenced in signature (Ljava/nio/file/Path;) 03-02 14:18:39.865 6123-6159/ W/dalvikvm: VFY: unable to find class referenced in signature ([Ljava/nio/file/OpenOption;) 03-02 14:18:39.865 6123-6159/ I/dalvikvm: Could not find method java.nio.file.Files.newInputStream, referenced from method okio.Okio.source 03-02 14:18:39.865 6123-6159/ W/dalvikvm: VFY: unable to resolve static method 30882: Ljava/nio/file/Files;.newInputStream (Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Ljava/io/InputStream;

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
garnet
  • 551
  • 5
  • 12
  • 1
    what kind of confirmation are you looking for, if the company behind okhttp telling you you need it is not enough? – Tim Mar 02 '18 at 09:27
  • " I did not include Okio" means you explicitly excluded it? Otherwise it would be included as a transitive dependency. – Henry Mar 02 '18 at 09:55
  • @Henry I did not exclude it. I was not sure if it is included as a transitive dependency. I have encountered some errors because of not explicitly including some dependencies: e.g: nimbus requires json smart. If I do not include json smart explicitly in gradle file as a dependency, it will result in a crash during runtime. If I remember correctly, it was NoClassDefFoundError. e.g: compile 'com.nimbusds:nimbus-jose-jwt:4.26@jar' compile group: 'net.minidev', name: 'json-smart', version: '2.3' – garnet Mar 02 '18 at 10:43
  • You can open the "External Libraries" node in the project view of Android Studio. This shows you all libraries that are included (either directly or transitively). – Henry Mar 02 '18 at 10:46
  • Thanks @Henry I confirmed that okio 1.14.0 is listed in "External Libraries" along with okhttp3.10.0. I will accept your answer, if you answer it below. Thanks a lot once again! :) – garnet Mar 02 '18 at 11:20

1 Answers1

2

okio is necessary for okhttp3 to work. However it is included automatically as a transitive dependency. So there is no need to include it explicitly.

Henry
  • 42,982
  • 7
  • 68
  • 84