如何添加Android的支持库到Android工作室? [英] How to add Android Support Repository to Android Studio?

查看:293
本文介绍了如何添加Android的支持库到Android工作室?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是Android的工作室与外部的Andr​​oid SDK。我已经安装了支持库和支持库。支持存储库是:

I'm using Android Studio with an external Android SDK. I have installed the support library and the support repository. The support repository is in:

~/Development/Tools/android/sdk/extras/android/m2repository

当我添加一个依赖在 build.gradle 文件的支持库,如:

When I add a dependency to the support library in the build.gradle file, like:

...

repositories {
    mavenCentral()
}

...

dependencies {
   compile "com.android.support:support-v4:18.0.+"
}

Android的工作室找不到支持库(不能解析符号等),摇篮也找不到库:

Android Studio cannot find the support libraries (cannot resolve symbol etc) and Gradle also cannot find the libraries:

Gradle: A problem occurred configuring project ':TestAndroidStudio'.
> Failed to notify project evaluation listener.
   > Could not resolve all dependencies for configuration ':TestAndroidStudio:_DebugCompile'.
      > Could not find any version that matches com.android.support:support-v4:18.0.+.
        Required by:
            TestAndroidStudio:TestAndroidStudio:unspecified

如何在机器人工作室指定和/或 build.gradle 文件的支持Android存储库的位置?

How do I specify in Android Studio and/or the build.gradle file the location of the Android support repository?

推荐答案

摇篮可以用18.0的工作。+符号,但是它现在要看这是现在捆绑在SDK中的新的支持库。

Gradle can work with the 18.0.+ notation, it however now depends on the new support repository which is now bundled with the SDK.

打开SDK管理器,并立即附加功能下的第一个选项是Android的支持库,并安装它

Open the SDK manager and immediately under Extras the first option is "Android Support Repository" and install it

这篇关于如何添加Android的支持库到Android工作室?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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