Android and Google client API NetHttptransport Class not found

前端 未结 4 1252
北恋
北恋 2020-12-10 10:15

I am trying to use the Google generated API library for the first time for Android. I have taken code from the the Sample Program provided by Google. My code looks like

4条回答
  •  攒了一身酷
    2020-12-10 10:42

    plus = Plus.builder(transport, jsonFactory).setApplicationName("Google-PlusSample/1.0")
        .setHttpRequestInitializer(accessProtectedResource)
        .setJsonHttpRequestInitializer(new JsonHttpRequestInitializer() {
            @Override
            public void initialize(JsonHttpRequest request) {
                PlusRequest plusRequest = (PlusRequest) request;
                plusRequest.setPrettyPrint(true);
            }
        }).build();
    

    use this instead of

    Plus plus = new Plus(new NetHttpTransport(), new JacksonFactory());
    

提交回复
热议问题