有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java NetHttpTransport无法解析为Google api实现的类型

我正在浏览Google表单的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


共 (1) 个答案

  1. # 1 楼答案

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

    import com.google.api.client.http.javanet.NetHttpTransport;