简体   繁体   English

在哪里将android支持库v7添加到build.gradle?

[英]Where do I add android support library v7 to build.gradle?

I am trying to use action bar in android 2.2, but i cant find build.gradle in my project? 我正在尝试在Android 2.2中使用操作栏,但在我的项目中找不到build.gradle吗? Can anybody help me please? 有人可以帮我吗?

Link is here: http://developer.android.com/tools/support-library/setup.html 链接在这里: http : //developer.android.com/tools/support-library/setup.html

Make sure you have downloaded the Android Support Repository using the SDK Manager.
**Open the build.gradle file for your application.**
Add the support library feature project identifier to the dependencies section. For example, to include the appcompat project add compile "com.android.support:appcompat-v7:18.0.+" to the dependencies section, as shown in the following example:
dependencies {
    ...
    compile "com.android.support:appcompat-v7:18.0.+"
}

In Android Studio you can search for a file. 在Android Studio中,您可以搜索文件。 So, in Windows try ctrl + shift + n or in Mac try cmd + shift + o . 因此,在Windows中尝试ctrl + shift + n或在Mac中尝试cmd + shift + o Then type build.gradle and the file will show up in the search results. 然后输入build.gradle ,文件将显示在搜索结果中。 Look for the block dependencies and add the support library there, like so 查找块dependencies然后在其中添加支持库,如下所示

 dependencies {
     ...
     compile 'com.android.support:support-v4:19.0.0'
 }

If you want to know more about gradle check the Android documentation . 如果您想了解有关gradle的更多信息,请查看Android文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM