Setting up the Google-api-java-client development environment

I am trying the official calendar-v2-atom-android example. I already imported all the dependency using maven and successfully compiling it. However, at runtime, no class definition error occurs when it comes to

private final List of calendars = Lists.newArrayList ();

private end HttpTransport transport = AndroidHttp.newCompatibleTransport ();

It seems that it cannot find the class in the library at runtime.

What to do in eclipse?

Thanks.

+1
source share
1 answer

Download Google Api Java Client

Create the libs folder in the eclipse project.

Drag all client files that don't end with -source to the libs folder you just created. Do not add the dependency folder; instead, drag the dependencies from the folder to the libs folder.

Go to Project -> Properties -> Java Build Path -> Libraries tab

Click "Add JARS", go to your libs folder and add all the client files.

Go to the Order and Export tab and check all the customer files that you have added.

Clean up the project. You should be fine.

Update

As in ADT Rev. 21, the setting works as follows:

  • Create libs folder in eclipse project
  • Drag all client files that don't end with -source to the libs folder you just created. Do not add the dependency folder; instead, drag the dependencies from the folder to the libs folder.
  • Go to the project → Properties → Java build path → Order and Export tab
  • Check the box next to “Android Private Libraries” and you’ll go well.
+7
source

Source: https://habr.com/ru/post/1387460/


All Articles