首页 > 解决方案 > NetHttpTransport 无法解析为 Google api 实现类型

问题描述

我正在浏览谷歌表格的谷歌 Java 快速入门页面,但在完成这些步骤并尝试运行提供的示例代码后,我收到以下错误:

Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
    NetHttpTransport cannot be resolved to a type
    GoogleNetHttpTransport cannot be resolved
    Sheets cannot be resolved to a type
    Builder cannot be resolved to a type
    Sheets cannot be resolved to a type
    JsonFactory cannot be resolved to a type
    The method getValues() is undefined for the type ValueRange

    at SheetsQuickstart.main(SheetsQuickstart.java:66)

关于可能导致它的任何想法?

这是我正在关注的快速入门表: https ://developers.google.com/sheets/api/quickstart/java

标签: javagoogle-sheetsgoogle-sheets-apigoogle-api-java-client

解决方案


检查你的进口。您需要导入此包以解决此错误并检查依赖项。

导入 com.google.api.client.http.javanet.NetHttpTransport;


推荐阅读