Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
352 views
in Technique[技术] by (71.8m points)

android - Setting up Google-api-java-client developing environment

I am trying the official example calendar-v2-atom-android. I have already import all dependency by using maven and it compile successfully. However, in run time , no class def found error occurs when it comes to

private final List calendars = Lists.newArrayList();

private final HttpTransport transport = AndroidHttp.newCompatibleTransport();

It seems that it can't find the class in library in runtime.

What should I do in eclipse?

Thank You.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Download the Google Api Java Client

Create a libs folder in your eclipse project.

Drag and drop all client files that do not end in -source into the libs folder you just made. Do not add the dependencies folder, instead drag the dependencies from inside the folder to the libs folder.

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

Click Add JARS, navigate to your libs folder and add all of the client files.

Click the Order and Export tab and check off all the client files you added.

Clean the project. You should be good to go.

Update

As of ADT Rev. 21, the setup works as follows:

  1. Create a libs folder in your eclipse project
  2. Drag and drop all client files that do not end in -source into the libs folder you just made. Do not add the dependencies folder, instead drag the dependencies from inside the folder to the libs folder.
  3. Go to Project -> Properties -> Java Build Path -> Order and Export Tab
  4. Check off the box for "Android Private Libraries" and you're good to go.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...