gpt4 book ai didi

java.lang.ClassNotFoundException : org. glassfish.jersey.client.JerseyClientBuilder 错误?

转载 作者:搜寻专家 更新时间:2023-11-01 01:05:58 27 4
gpt4 key购买 nike

我遇到了错误:java.lang.ClassNotFoundException: org.glassfish.jersey.client.JerseyClientBuilder 但是我已经导入了这些类,所以我不确定它为什么会弹出。我的 build.gradle 和代码如下:

private String getAccessToken() {
try {
Log.e("tree","get access entered");
javax.ws.rs.client.Client client = javax.ws.rs.client.ClientBuilder.newClient();
javax.ws.rs.client.Entity<String> payload =
javax.ws.rs.client.Entity.text("grant_type=client_credentials&redirect_uri=https://facebook.com/__");
javax.ws.rs.core.Response response = client.target("https://v2.api.xapo.com/oauth2/token")
.request(MediaType.TEXT_PLAIN_TYPE)
.header("Authorization","Basic ___")
.post(payload);
Log.e("tree","response completed");
String body = response.readEntity(String.class);
Log.e("tree","body "+body);
} catch(Exception e) {
Log.e("tree","token exception "+e.getMessage());
}
return "";
}

最佳答案

您缺少 org.glassfish.jersey.core:jersey-client 依赖项。

关于java.lang.ClassNotFoundException : org. glassfish.jersey.client.JerseyClientBuilder 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36167042/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com