找不到Android支持库

时间:2014-09-23 23:47:11

标签: android windows gradle

我正在使用Facebook SDK进行Android项目,我在将support-v4库编译到我的项目时遇到了问题。我得到的错误是:Could not find com.android.support:support-v4:13.0.0

我已使用SDK安装了Android支持存储库。

让我感到困惑的是,看起来gradle不会尝试使用本地maven存储库。当我在工作机器上运行gradlew.bat assembleDebug --debug时,我得到:

19:01:23.803 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder] Visiting configuration <PROJECT>.facebook-android-sdk-3.14.1:facebook:unspecified(_debugCompile). 669
19:01:23.803 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder] Visiting dependency <PROJECT>.facebook-android-sdk-3.14.1:facebook:unspecified(_debugCompile) -> com.android.support:support-v4:13.0.+(dependency: com.android.support#support-v4;13.0.+ {compile=[default]})
19:01:23.804 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver] Attempting to resolve module 'com.android.support:support-v4:13.0.+' using repositories [BintrayJCenter, maven, maven2]

在非工作机器上,我得到:

...
23:27:41.642 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver] Attempting to resolve module 'com.android.support:support-v4:20.0.0' using repositories [BintrayJCenter]

其他相关信息:

ANDROID_HOME=C:\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\sdk

Path=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Git\cmd\;C:\apache-ant-1.9.3-bin\apache-ant-1.9.3\bin\;C:\Program Files\Java\jdk1.7.0_67\bin;C:\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\sdk\tools;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files (x86)\Microsoft SDKs\Azure\CLI\wbin;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\PSTools;C:\apache-maven-3.0.3-bin\apache-maven-3.0.3\bin;C:\Program;C:\NUnit-2.6.3\NUnit-2.6.3\bin\

1 个答案:

答案 0 :(得分:0)

事实证明ANDROID_HOME路径不正确。我以为是:

ANDROID_HOME=C:\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\sdk

但实际上是:

ANDROID_HOME=C:\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\sdk\tools

关闭当前的命令提示符并打开一个新的提示后,它运行正常。