Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.collect.ImmutableSet.copyOf([Ljava/lang/Object;)Lcom/google/common/collect/ImmutableSet;

3,381 views
Skip to first unread message

Himanshu Malviya

unread,
Oct 1, 2015, 7:23:59 AM10/1/15
to guava-discuss
i am facing these error tried a lot to replace  >>guava-##.jar<< all kind of version which is available in Web all i tried ......

please provide some solution what i need to do .... same code sam project copy if i am using in different machine it's creating problem......



......///////////Please give me any solution



        Credential credential = getCredentials();
        System.out.println("here");

        SpreadsheetService service = new SpreadsheetService("spreadsheet");   //// here is the problem <<<<<<<<<<<<<with above capture
        service.setOAuth2Credentials(credential);

        // Define the URL to request. This should never change.
        URL SPREADSHEET_FEED_URL = new URL("https://spreadsheets.google.com/feeds/spreadsheets/private/full");

        // Make a request to the API and get all spreadsheets.
        SpreadsheetFeed feed = service.getFeed(SPREADSHEET_FEED_URL, SpreadsheetFeed.class);
        List<SpreadsheetEntry> spreadsheets = feed.getEntries();

        // Iterate through all of the spreadsheets returned
        for (SpreadsheetEntry spreadsheet : spreadsheets) {
            // Print the title of this spreadsheet to the screen
            System.out.println(spreadsheet.getTitle().getPlainText());
            System.out.println(spreadsheet.getHtmlLink().toString());
Capture.JPG
Capture2.JPG

Olivier Grégoire

unread,
Oct 1, 2015, 7:47:45 AM10/1/15
to Himanshu Malviya, guava-discuss
You should remove your dependency to google-collections since google-collections is the old guava (you can think of google-collections as guava 1). The method ImmutableSet.copyOf(E[]) was added in guava version 3, so *after* google-collections.

This being said, you should also post this kind of questions on stackoverflow.com.

Regards,

Olivier
 

--
guava-...@googlegroups.com
Project site: https://github.com/google/guava
This group: http://groups.google.com/group/guava-discuss
 
This list is for general discussion.
To report an issue: https://github.com/google/guava/issues/new
To get help: http://stackoverflow.com/questions/ask?tags=guava
---
You received this message because you are subscribed to the Google Groups "guava-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guava-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/guava-discuss/1d07f36b-eb0c-4884-b222-6809d4d168ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Himanshu Malviya

unread,
Oct 1, 2015, 1:50:03 PM10/1/15
to guava-discuss
yes now is working fine thanku you so much ... you saved my 2 days :)
Reply all
Reply to author
Forward
0 new messages