自从升级到Android SDK API 19(KitKat)以来,在尝试构建我的项目时遇到以下错误:
The method setVisibleActivities(String, String) is undefined for the type PlusClient.Builder
如果我看看this question,它有一个指向API的链接,显然已经记录了此功能-但它似乎也从那里消失了。

这是有问题的代码: PlusClient mPlusClient = new PlusClient.Builder(this, this, this) .setVisibleActivities("http://schemas.google.com/AddActivity", "http://schemas.google.com/BuyActivity") .build();

最佳答案

我可以通过替换来解决此问题

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


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
        .build();

错误现在应该消失了。

您可以在这里找到更多关于此的信息:https://developers.google.com/+/mobile/android/getting-started#step_4_initialize_the_plusclient

09-05 17:47