简体   繁体   中英

Is it mandatory to include okio if an app wants to use okhttp3?

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;

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM