我正在尝试将Vimeo API集成到 android 中,但出现以下错误:
使用 JsonReader.setLenient(true) 在第 1 行第 1 列路径 $ 接受格式错误的 JSON
这是我的代码:
public void onCreate(Bundle savedInstanceState) {
Log.i(TAG, "onCreate");
super.onCreate(savedInstanceState);
final Video video = VideoPlayActivity.video;
TestApp d = new TestApp();
d.onCreate();
mApiClient = d.getmApiClient();
String uri = video.getVideoUri().toString();
mApiClient.getInstance().fetchNetworkContent(uri, new ModelCallback<Video>(Video.class) {
@Override
public void success(Video video) {
Log.i(TAG, "get success.");
// use the video
}
@Override
public void failure(VimeoError error) {
Log.i(TAG, error.getErrorMessage());
// voice the error
}
});
}
这些是TestApp中的重要方法:
public class TestApp extends Application {
@Override
public void onCreate() {
super.onCreate();
Log.i(TAG, "onCreate");
sContext = this;
Configuration.Builder configBuilder = getClientIdAndClientSecretBuilder();
VimeoClient.initialize(configBuilder.build());
mApiClient = VimeoClient.getInstance();
}
public Configuration.Builder getClientIdAndClientSecretBuilder() {
String clientId = "dc62dc72e8c7cf4d0b7bb025d41e2a7649ddc0a4";
String clientSecret = "SRbzt7mLfbA0l5aEV8lXINE54nRGkSp8S2i+wOp9paOqQsEKkwC5MtdwFPHiVqX7DTCooPVWAxPVjG8/pjjPbl+7LNTXTuSDit1oZGtCjkBYFqahb95J4pAHzEumdNhs";
return new Configuration.Builder(clientId, clientSecret, SCOPE);
}
}