嘿,我正在开发一个应用程序,用于更新我在Google Play控制台中应用程序的商店列表
我在这行出现错误
Insert editRequest = edits.insert(ApplicationConfig.PACKAGE_NAME, null /** no content */);
AppEdit edit = editRequest.execute();
这是错误
Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Splitter.splitToList(Ljava/lang/CharSequence;)Ljava/util/List;
at com.google.api.client.http.UriTemplate.expand(UriTemplate.java:305)
at com.google.api.client.http.UriTemplate.expand(UriTemplate.java:262)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.buildHttpRequestUrl(AbstractGoogleClientRequest.java:266)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.buildHttpRequest(AbstractGoogleClientRequest.java:301)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:419)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469)
at com.google.play.developerapi.samples.UpdateListing.main(UpdateListing.java:64)
这是我的代码
public static void main(String[] args) {
try {
Preconditions.checkArgument(!Strings.isNullOrEmpty(ApplicationConfig.PACKAGE_NAME),
"ApplicationConfig.PACKAGE_NAME cannot be null or empty!");
// Create the API service.
AndroidPublisher service = AndroidPublisherHelper.init(
ApplicationConfig.APPLICATION_NAME, ApplicationConfig.SERVICE_ACCOUNT_EMAIL);
final Edits edits = service.edits();
// Create an edit to update listing for application.
Insert editRequest = edits.insert(ApplicationConfig.PACKAGE_NAME, null /** no content */);
AppEdit edit = editRequest.execute();
final String editId = edit.getId();
log.info(String.format("Created edit with id: %s", editId));
// Update listing for US version of the application.
final Listing newHRListing = new Listing();
newHRListing.setTitle(US_LISTING_TITLE)
.setFullDescription(US_LISTING_FULL_DESCRIPTION)
.setShortDescription(US_LISTING_SHORT_DESCRITPION);
Update updateUSListingsRequest = edits
.listings()
.update(ApplicationConfig.PACKAGE_NAME,
editId,
Locale.getDefault().toString(),
newHRListing);
Listing updatedUsListing = updateUSListingsRequest.execute();
log.info(String.format("Created new US app listing with title: %s",
updatedUsListing.getTitle()));
// Create and update listing for UK version of the application.
// Commit changes for edit.
Commit commitRequest = edits.commit(ApplicationConfig.PACKAGE_NAME, editId);
AppEdit appEdit = commitRequest.execute();
log.info(String.format("App edit with id %s has been comitted", appEdit.getId()));
} catch (IOException | GeneralSecurityException ex) {
log.error("Exception was thrown while updating listing", ex);
}
}