Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/317.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Gmail API获取消息';无法解析方法execute()';_Java_Api_Intellij Idea_Gmail - Fatal编程技术网

Java Gmail API获取消息';无法解析方法execute()';

Java Gmail API获取消息';无法解析方法execute()';,java,api,intellij-idea,gmail,Java,Api,Intellij Idea,Gmail,我正在尝试为用户运行示例java代码。但是,“execute()”方法上的my IDE(IntelliJ)错误: '无法解析方法execute()' 我有必要的依赖项,google-api-services-gmail-v1-rev43-1.2.2.0.jar。我还缺少另一种依赖吗 /** * List all Messages of the user's mailbox matching the query. * * @param service Authorized Gm

我正在尝试为用户运行示例java代码。但是,“execute()”方法上的my IDE(IntelliJ)错误:

'无法解析方法execute()'

我有必要的依赖项,google-api-services-gmail-v1-rev43-1.2.2.0.jar。我还缺少另一种依赖吗

 /**
   * List all Messages of the user's mailbox matching the query.
   *
   * @param service Authorized Gmail API instance.
   * @param userId User's email address. The special value "me"
   * can be used to indicate the authenticated user.
   * @param query String used to filter the Messages listed.
   * @throws IOException
   */
  public static List<Message> listMessagesMatchingQuery(Gmail service, String userId,String query) throws IOException {
    ListMessagesResponse response = service.users().messages().list(userId).setQ(query).execute();
/**
*列出与查询匹配的用户邮箱的所有邮件。
*
*@param服务授权Gmail API实例。
*@param userId用户的电子邮件地址。“我”的特殊价值
*可用于指示经过身份验证的用户。
*@param查询字符串用于筛选列出的消息。
*@抛出异常
*/
公共静态列表listMessagesMatchingQuery(Gmail服务、字符串用户ID、字符串查询)引发IOException{
ListMessagesResponse response=service.users().messages().list(userId).setQ(query.execute();
错误:无法解析方法execute()compile我遇到了相同的问题。 尝试在gradle文件中添加此依赖项,它解决了我的问题

编译'com.google.api:googleapi服务gmail:v1-rev48-1.22.0'