Closed anil-patel-pcln closed 3 years ago
Did I miss something in the above code because this code seems to be working with v3 version of google-ads-5.0.0.jar with just minor change
below is the working section for v3
SearchGoogleAdsRequest request =
SearchGoogleAdsRequest.newBuilder()
.setCustomerId("xxxxx")
.setPageSize(PAGE_SIZE)
.setQuery(searchQuery)
.setReturnSummaryRow(true)
.build();
but for v5/v6 I made the change to have
SearchGoogleAdsRequest request =
SearchGoogleAdsRequest.newBuilder()
.setCustomerId("xxxxx")
.setPageSize(PAGE_SIZE)
.setQuery(searchQuery)
.setSummaryRowSetting(SummaryRowSetting.SUMMARY_ROW_WITH_RESULTS)
.build();
I don't know the actual issue by looking at the logs and docs please let me know if I am missing anything any help will be appreciated.
Hi,
I looked in our logs and the underlying error for that request is CANNOT_RETURN_SUMMARY_ROW_FOR_REQUEST_WITHOUT_METRICS
, which means that you are requesting SUMMARY_ROW_WITH_RESULTS
, but your query does not request any fields starting with metrics.
.
Does the request succeed if you remove that option?
Thanks, Josh
So the code should be fine, I tweaked it to run with my credentials and I get back a fairly normal error (the API rejects the query though, see logs.
You can see the root cause of your error in your original post, it's hidden deep inside the response payload:
com.google.ads.googleads.v6.errors.GoogleAdsFailure@5e9e0d97=>java.lang.NoSuchMethodError:com.google.protobuf.Descriptors$FileDescriptor.internalBuildGeneratedFileFrom([Ljava/lang/String;[Lcom/google/protobuf/Descriptors$FileDescriptor;)Lcom/google/protobuf/Descriptors$FileDescriptor;!!!
It appears that you have an incompatible version of protobuf being loaded. This is quite a common issue, since protobuf is a popular open source project.
One way to avoid this would be to just set the version of protobuf in your pom.xml to the version that the Ads API requires.
Just adding the following to your pom.xml will likely fix the problem. I got this by running mvn dependency:tree -f google-ads/pom.xml
on the root of the client library.
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.12.0</version>
Just be careful that this doesn't break somewhere else in your project. It shouldn't be a problem, since protobuf should be backwards compatible, but worth making sure.
You can also figure this out by looking at your project's depednency tree in verbose mode: mvn dependency:tree -f path-to-your/pom.xml -Dverbose
will show the dependency conflicts that you have. Then you can often resolve these by selecting the newer version of the dependency.
Thanks, Josh and Nick for helping me I have tried to update the protobub version and it worked. @jradcliff you were correct no need to add SUMMARY_ROW_WITH_RESULTS and I have removed it from my code.
I am closing the issue. Thanks, Josh and Nick.
Client Library version:- 10.1.0
Java version:- openjdk version "1.8.0_252" OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_252-b09) OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.252-b09, mixed mode)
Linux:- Centos7
Below is the code that I am using to get ad_group id for the specific customer.
below is a query that I have used in the code:-
select ad_group.id from ad_group where ad_group.status = ENABLED and ad_group.type = HOTEL_ADS AND " + "campaign.status != 'REMOVED' "
Please find below logs for one account with request and response in logs.