android - 如何在 Android 应用程序中使用来自 GitHub 的库

标签 android github gradle libraries

我下载了this library但是,要在我的应用程序中使用,我现在无法让 Android Studio 进行 gradle 构建。每当我尝试时,我都会收到“错误:找不到名称为‘默认’的配置”。我已经尝试了其他几个 StackOverflow 答案,但我仍然无法编译。

我的依赖项(来自 build.gradle 模块:app)

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:support-v4:22.1.1'
compile project(":aFileDialog")
}

我的settings.gradle:
include ':app'
include ':aFileDialog'

我在“aFileDialog”下的根目录中有库文件

我怎样才能让它与图书馆一起构建?

最佳答案

您已将路径添加到 aFileDialog您的 settings.gradle 中的图书馆

确保您指向的文件夹包含 build.gradle文件

include ':app'
include ':aFileDialog'
project(':aFileDialog').projectDir = new File(settingsDir, 'aFileDialog')

或者(从 GitHub 上的库文件夹结构来看)
project(':aFileDialog').projectDir = new File(settingsDir, 'aFileDialog/library')

关于android - 如何在 Android 应用程序中使用来自 GitHub 的库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30987728/

相关文章:

android - task.getResult() 返回空值?

github - 如何在 Bitbucket 和 github markdown 中显示数学表达式?

git - 使用 GitHub Pages 时了解 Jekyll 和 gh-pages 分支

java - 在gradle中如何使用来自项目外部相对路径的源

在多模块项目中使用 Gradle 的 Android AspectJ

android - android中的registerForActivityResult如何处理多个请求?

android - 上传付费和免费版本的应用程序

github - 如何为多个 Google Cloud Functions 设置一个 GitHub 存储库?

ruby - Asciidoctor::HTML5::DocumentTemplate替换

android - 为 android mips 编译 libcurl