【问题标题】:error in adding google play services as reference library in eclipse在 Eclipse 中添加 google play 服务作为参考库时出错
【发布时间】:2014-03-09 14:41:02
【问题描述】:

1> 当我添加 google play services 库时,它显示 green right 标记,但是当我按下 ok 并重新打开项目属性时,它显示 red cross 标记。

2> 在 Eclipse 中,当我创建新的 android 项目时,默认情况下会创建 ActionBarActivity 安装的 Activity。为什么?

public class MainActivity extends ActionBarActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    if (savedInstanceState == null) {
        getSupportFragmentManager().beginTransaction()
                .add(R.id.container, new PlaceholderFragment()).commit();
    }
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {

    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}

【问题讨论】:

  • ActionBarActivity 来自 AppCompat 兼容性库。 developer.android.com/tools/support-library/features.html
  • shkschneider 感谢您的回复。如何将其恢复为 Activity ?你知道问题 1 吗?
  • 2.为什么要取消兼容性? 1.请发截图
  • 对于 1. 确保库路径正确。图书馆实际上就在那里。如果你没有正确引用图书馆,你会得到一个红十字

标签: android eclipse google-play-services


【解决方案1】:

我找到了解决办法

*复制 google-play-services-lib 并将其粘贴到其他位置。
*更改 Eclipse 工作区。
* 将 google-play-services-lib 作为现有 Android 代码导入工作区。浏览到新位置并选择 google-play-services-lib 文件夹。
* 转到项目属性->android->添加并选择 google-play-services-lib。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-05-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多