Appcompat /加与Android工作室库工作室、Appcompat、Android

2023-09-04 03:53:51 作者:你若不离我便生死相依

[修正]当你添加你的依赖,你需要同步您的项目。这是对AVD管理器图标左边

大家好,

我试图用appcompat-V7采用Android工作室。 我添加这些行:

I'm trying to use the appcompat-v7 with android studio. I add those lines:

dependencies {
    compile 'com.android.support:appcompat-v7:18.0.+'
}

在build.gradle但是当我尝试导入的lib:

In the build.gradle but when I try to import the lib:

import android.support.v7.app.ActionBar;

它说我解决不了V7。而当我检查的文件夹外部​​的lib只有支持-V4。

It says me that cannot resolve v7 .. And when I check the folder external lib there is only support-v4.

我错过了什么?

诗:它的工作在其他项目中,我可以看到外部的lib的lib,但不想再做了。

Ps: It worked in an other project and I could see the lib in external lib but it don't want do it again ..

推荐答案

您应该有两个依赖关系:

You should have two dependencies:

dependencies {
    compile 'com.android.support:support-v4:18.0.+'
    compile 'com.android.support:appcompat-v7:18.0.+'
}

确认您已经下载了最新的Andr​​oid支持库和支持库的SDK管理器中。

Verify that you have downloaded the latest Android Support Library and Support Repository within your SDK manager.

http://developer.android.com/tools/support-library/setup.html#download

详细的教程有关设置ActionBarActivity:

Detailed tutorial on setting up the ActionBarActivity:

http://www.blackcj.com/blog/2013/08/14/actionbar-with-android-support-library-r18/