如何在 android 应用中使用来自 GitHub 的库
How to use Library from GitHub in android App
我下载了 this library 以在我的应用程序中使用,但是,我现在无法让 Android Studio 执行 gradle 构建。每当我尝试时,我都会得到 "error:configuration with name 'default' not found"。我已经尝试了其他几个 Whosebug 答案,但我仍然无法编译。
我的依赖项(来自 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"
我怎样才能用库构建它?
您已在 settings.gradle
中添加 aFileDialog
库的路径
确保您指向的文件夹包含 build.gradle
文件
include ':app'
include ':aFileDialog'
project(':aFileDialog').projectDir = new File(settingsDir, 'aFileDialog')
或(根据 GitHub 上的库文件夹结构判断)
project(':aFileDialog').projectDir = new File(settingsDir, 'aFileDialog/library')
我找到了有效的教程:http://www.theappguruz.com/tutorial/library-project-module-as-dependency-in-android-studio/
除了给出的说明之外,我还必须将以下行添加到我的清单中:
tools:replace = "icon, label"
我下载了 this library 以在我的应用程序中使用,但是,我现在无法让 Android Studio 执行 gradle 构建。每当我尝试时,我都会得到 "error:configuration with name 'default' not found"。我已经尝试了其他几个 Whosebug 答案,但我仍然无法编译。
我的依赖项(来自 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"
我怎样才能用库构建它?
您已在 settings.gradle
aFileDialog
库的路径
确保您指向的文件夹包含 build.gradle
文件
include ':app'
include ':aFileDialog'
project(':aFileDialog').projectDir = new File(settingsDir, 'aFileDialog')
或(根据 GitHub 上的库文件夹结构判断)
project(':aFileDialog').projectDir = new File(settingsDir, 'aFileDialog/library')
我找到了有效的教程:http://www.theappguruz.com/tutorial/library-project-module-as-dependency-in-android-studio/
除了给出的说明之外,我还必须将以下行添加到我的清单中:
tools:replace = "icon, label"