简体   繁体   English

Google Analytics API示例JAVA

[英]Google Analytics API example JAVA

Google analytics posted on their blog about an example Java program to extract data and output to a CSV using the analytics api, im trying to compile this program to run it in eclipse but running into problems Google Analytics(分析)在他们的博客上发布了有关一个示例Java程序的示例,该Java程序使用analytics api提取数据并输出到CSV,试图编译该程序以使其在Eclipse中运行但遇到了问题

http://code.google.com/p/ga-api-java-samples/source/browse/trunk/src/v2/DataOverTime/src/example/MainDemo.java http://code.google.com/p/ga-api-java-samples/source/browse/trunk/src/v2/DataOverTime/src/example/MainDemo.java

i have changed out the variables in here to my own: 我已经将这里的变量更改为自己的变量:

// User configurations.
  private static final String USERNAME = "INSERT_YOUR_GOOGLE_ACCOUNT_LOGIN";
  private static final String PASSWORD = "INSERT_YOUR_GOOGLE_ACCOUNT_PASSWORD";
  private static final String TABLE_ID = "INSERT_YOUR_TABLE_ID";

i'm unsure on the next step, when i try to run the program i get this error message: 我不确定下一步,当我尝试运行该程序时,出现以下错误消息:

    Exception in thread "main" java.lang.Error: Unresolved compilation problem: 

    at MainDemo.main(main.java:51)

update: 更新:

ok, its says when using the google analytics API i need to reference some .jar files: 好的,它说,当使用Google Analytics API时,我需要引用一些.jar文件:

gdata-core-1.0.jar gdata-client-meta-1.0.jar gdata-client-1.0.jar gdata-analytics-meta-2.0.jar gdata-analytics-2.0.jar google-collect-1.0-rc1.jar jsr305.jar gdata-core-1.0.jar gdata-client-meta-1.0.jar gdata-client-1.0.jar gdata-analytics-meta-2.0.jar gdata-analytics-2.0.jar google-collect-1.0-rc1.jar jsr305。罐

i put these in but its still not working i get the following error message: 我把它们放进去了,但是它仍然不起作用,我收到以下错误消息:

Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
    Results cannot be resolved to a type
    The method getData(DataQuery) from the type DataOverTime refers to the missing type Results

Is your directory structure correct? 您的目录结构正确吗? It should look somewhat like the url of the example. 它看起来应该像示例的URL。 The file has to be './example/MainDemo.java' and compile it from '.' 该文件必须为“ ./example/MainDemo.java”,并从“。”进行编译。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM