Skip to content

Android can't use custom OkHttpClient #15998

@celesteshire

Description

@celesteshire

Is this a bug report?

(Yes)

Have you read the Contributing Guidelines?

(No)

Environment

  1. react-native -v: 2.0.1
  2. node -v: v8.4.0
  3. npm -v: 5.3.0

Then, specify:

  • Target Platform: Android
  • Development Operating System: macOS
  • Build tools: Android Studio

Steps to Reproduce

(Write your steps here:)

use OkHttpClientProvider.replaceOkHttpClient(customClient);

Expected Behavior

Can use customClient

Actual Behavior

Every time you re-create a new one internally OkHttpClient

Because the following code causes the problem(this is NetworkingModule.java):

public NetworkingModule(final ReactApplicationContext context) {
    this(context, null, OkHttpClientProvider.createClient(), null);
}

Every time it's new

but

image

Will not be used to the customClient

Metadata

Metadata

Assignees

No one assigned

    Labels

    StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions