Home » Android » android – setVisibleActivities undefined

android – setVisibleActivities undefined

Posted by: admin June 15, 2020 Leave a comment


Ever since upgrading to Android SDK API 19 (KitKat), I’m getting the following error when trying to build my project:

The method setVisibleActivities(String, String) is undefined for the type PlusClient.Builder

If I look at this question, it has a link to the API where apparently this function was documented – but it appears to have simply disappeared from there as well.

Here is the code in question:

PlusClient mPlusClient = new PlusClient.Builder(this, this, this)
.setVisibleActivities("http://schemas.google.com/AddActivity", "http://schemas.google.com/BuyActivity")

How to&Answers:

I was able to fix this problem by replacing

PlusClient mPlusClient =
    new PlusClient.Builder(this, this, this).setVisibleActivities(
        "http://schemas.google.com/AddActivity", "http://schemas.google.com/BuyActivity")


PlusClient mPlusClient =
    new PlusClient.Builder(this, this, this).setActions(
        "http://schemas.google.com/AddActivity", "http://schemas.google.com/BuyActivity")
        .setScopes("PLUS_LOGIN") // Space separated list of scopes

Errors should be gone now.

You can find more about that here: https://developers.google.com/+/mobile/android/getting-started#step_4_initialize_the_plusclient


I just ran into this with a project I was trying to build. Apparently it needed the Google Play Services for Froyo library instead of the normal one. It wasn’t clear because they’re both referred to as google-play-services_lib in the project.properties file.