settings.gradle :
include ':app'
include ':app:libraries:shinobicharts-android-library'
的build.gradle :
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.rohit2906.myhistogram"
minSdkVersion 11
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile project('libraries:shinobicharts-android-library')
}
我正在尝试添加库项目,这是shinobicharts-android-library,它位于库文件夹中。请帮助我。
答案 0 :(得分:1)
您必须为项目中的每个模块定义build.gradle。
在另一个模块中定义模块也不是一个好主意。
你应该有这样的结构:
root
app
build.gradle
libraries
shinobicharts-android-library
build.gradle
build.gradle //top level
settings.gradle
在settings.gradle
更改:
include ':app'
include ':libraries:shinobicharts-android-library'
在app/build.gradle
更改
compile project(':libraries:shinobicharts-android-library')
在shinobicharts-android-library/build.gradle
:
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 11
targetSdkVersion 21
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
//...other
}