Appcompat/用android studio 添加一个库 [英] Appcompat / add a library with android studio

查看:28
本文介绍了Appcompat/用android studio 添加一个库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

[已修复] 添加依赖项后,您需要同步项目.这是AVD Manager图标左侧的图标

大家好,

我正在尝试在 android studio 中使用 appcompat-v7.我添加了这些行:

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 .. 当我检查文件夹 external lib 时,只有 support-v4.

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

我错过了什么吗?

Ps:它在另一个项目中工作,我可以在外部库中看到该库,但它不想再这样做了..

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

推荐答案

你应该有两个依赖:

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

确认您已在 SDK 管理器中下载了最新的 Android 支持库和支持库.

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#下载

设置 ActionBarActivity 的详细教程:

Detailed tutorial on setting up the ActionBarActivity:

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

这篇关于Appcompat/用android studio 添加一个库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆