我有一个多模块gradle项目:
app
app-libs
app-support
app-main
应用程序支持/的build.gradle:
apply plugin: 'java'
buildscript {
repositories {
flatDir dirs: 'D:\\docs\\development\\java\\tools\\proguard4.11\\lib'
}
dependencies {
classpath ':proguard:'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile fileTree(dir:"${rootDir}/app-libs/esri",include:['*.jar'])
}
task myProguardTask(type: proguard.gradle.ProGuardTask) {
configuration 'proguard-rules.txt'
}
APP-主/的build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 9
targetSdkVersion 16
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
}
dependencies {
compile 'com.android.support:appcompat-v7:19.+'
compile project(':app-support')
}
现在,当我运行gradlew build
时,它会在构建app-main
模块时抛出错误,该模块表示无法找到app-libs / esri / xx.jars中定义的类。
有什么问题?
gradlw build > log.txt
生成如下日志:
Parallel execution is an incubating feature.
Relying on packaging to define the extension of the main artifact has been deprecated and is scheduled to be removed in Gradle 2.0
:app-main:compileDebugNdk
:app-support:compileJava UP-TO-DATE
:app-main:preBuild
:app-main:preDebugBuild
:app-main:checkDebugManifest
:app-main:preReleaseBuild
:app-main:generateDebugBuildConfig UP-TO-DATE
:app-support:processResources UP-TO-DATE
:app-support:classes UP-TO-DATE
:app-support:jar UP-TO-DATE
:app-support:assemble UP-TO-DATE
:app-support:compileTestJava UP-TO-DATE
:app-support:processTestResources UP-TO-DATE
:app-support:testClasses UP-TO-DATE
:app-support:test UP-TO-DATE
:app-main:prepareComAndroidSupportAppcompatV71901Library UP-TO-DATE
:app-support:check UP-TO-DATE
:app-support:build UP-TO-DATE
:app-main:compileDebugNdk UP-TO-DATE
:app-main:prepareDebugDependencies
:app-main:compileDebugAidl UP-TO-DATE
:app-main:compileDebugRenderscript UP-TO-DATE
:app-main:mergeDebugAssets UP-TO-DATE
:app-main:generateDebugResValues UP-TO-DATE
:app-main:generateDebugResources UP-TO-DATE
:app-main:mergeDebugResources UP-TO-DATE
:app-main:processDebugManifest UP-TO-DATE
:app-main:processDebugResources UP-TO-DATE
:app-main:generateDebugSources UP-TO-DATE
:app-main:compileDebugJava FAILED
BUILD FAILED
Total time: 8.577 secs
控制台出错:
D:\workspace\app\app-main\src\main\java\com\api\test\MainActivity.java:9: Error: Package com.esri.android.map does not exist