我想在我的应用程序中添加一个外部库GuillotineMenu-Android。我按照现有问题的最受欢迎的答案中给出的步骤进行操作How do I add a library project to the Android Studio?,但是当我尝试构建项目时遇到错误,即在第6步之后添加依赖项
app/build.gradle
,如compile project(":guillotinemenu")
。我尝试了所有与此错误相关的stackoverflow链接,但它们都没有起作用。我在我的应用程序目录中创建了一个名为libs的文件夹,并将项目文件夹guillotine menu复制到其中。这是我的build.gradle(Module:app)
文件。apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.sunshine.bbreaker.appet_i"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:recyclerview-v7:+'
compile 'com.github.navasmdc:MaterialDesign:1.+@aar'
compile 'com.android.support:appcompat-v7:22.0.+'
// GuillotineMenu
compile project(":guillotinemenu")
}
settings.gradle(项目设置)文件:
include ':app', ':guillotinemenu'
project(':guillotinemenu').projectDir = new File('libs/guillotinemenu')
build.gradle(Project:guillotinemenu)文件:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}} allprojects {
repositories {
jcenter()
}}
settings.gradle(Project:guillotinemenu)文件:
include ':app', ':library'
build.gradle(guillotinemenu) 文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.yalantis.guillotine.sample"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile project(':library')
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.jakewharton:butterknife:6.1.0'
}
如果您需要更多信息,请告诉我。提前致谢。