我想添加外部库https://github.com/foursquare/foursquare-android-oauth https://github.com/foursquare/foursquare-android-oauth到我的 Android 应用程序(我使用 Android Studio,lib 作者为 Eclipse 提供的说明不适用于 Android Studio)。
我尝试使用 Maven 来完成此操作,因此在文件->项目结构->依赖项中添加了com.foursquare:foursquare-android-nativeoauth-lib:1.0.0
但 Gradle 同步失败:
Error:Failed to find: com.foursquare:foursquare-android-nativeoauth-lib:1.0.0
当我尝试构建我的应用程序(没有修复上述错误,因为我不知道如何)时,我得到:
Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not resolve com.foursquare:foursquare-android-nativeoauth-lib:1.0.0.
Required by:
ForSquaresOnly:app:unspecified
> Could not parse POM http://jcenter.bintray.com/com/foursquare/foursquare-android-nativeoauth-lib/1.0.0/foursquare-android-nativeoauth-lib-1.0.0.pom
> Could not find any version that matches com.foursquare:parent:1.0.0.
还有其他方法导入这个库吗?我可以简单地将源代码复制粘贴到我的源代码中或从中创建 JAR 吗?
顺便说一句:如果您遇到问题,请参阅此问题(导入后我遇到了此问题):清单合并失败:uses-sdk:minSdkVersion 14 https://stackoverflow.com/questions/24438170/manifest-merger-failed-uses-sdkminsdkversion-14
尝试以下方法之一:
方法1)
1-选择项目视图
2- 将 JAR 文件复制到 app -> lib 文件夹中
3-右键单击您的 JAR 文件并选择添加为库
4-在build.gradle中检查它
方法2)
1- 文件 -> 新建 -> 新模块
2-导入.JAR/.AAR包
3-浏览您的 JAR 文件
4-完成
5- 文件 -> 项目结构 -> 依赖项
6-您应该单击+按钮,然后单击模块依赖项
7-您将在这里看到您的图书馆
8-选择您的库并单击“确定”
9-然后,您将看到您的图书馆已添加。
对于前两种方法,您需要一个 JAR 文件。您可以搜索http://search.maven.org/ http://search.maven.org/查找与 Android 相关的 JAR 文件。例如,这是此链接中 jdom 的搜索结果
方法3)安卓正在使用http://jcenter.bintray.com/ http://jcenter.bintray.com/作为远程库。例如,这是链接中jdom的搜索结果。
要以此方法添加库,请按照下列步骤操作:
1- 文件 -> 项目结构 -> 依赖项
2-单击+按钮并选择库依赖项
3-找到您的库并选择它,然后单击“确定”。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)