我想添加外部库GuillotineMenu-Android https://github.com/Yalantis/GuillotineMenu-Android在我的应用程序中。我按照现有问题的得票最高的答案中给出的步骤进行操作如何将库项目添加到 Android Studio? https://stackoverflow.com/questions/16588064/how-do-i-add-a-library-project-to-the-android-studio但是当我在第 6 步之后尝试构建项目时,即在添加依赖项时,我遇到了错误app/build.gradle
as compile project(":guillotinemenu")
。我尝试了与此错误相关的所有 stackoverflow 链接,但没有成功。我在应用程序目录中创建了一个名为 libs 的文件夹并复制了项目文件夹断头台菜单那里。这是我的build.gradle(Module:app)
file
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(项目设置) file:
include ':app', ':guillotinemenu'
project(':guillotinemenu').projectDir = new File('libs/guillotinemenu')
build.gradle(项目:guillotinemenu) file:
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(项目:guillotinemenu) file:
include ':app', ':library'
build.gradle(断头台菜单) file:
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'
}
如果您需要更多信息,请告诉我。提前致谢。