我真的很喜欢这个:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion '20.0.0'
defaultConfig {
applicationId "com.example.testing"
minSdkVersion 14
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile project(':External-Module')
}
我不知道该怎么做......我无法构建项目并使用外部模块中的依赖项。
错误是:
Error:(7, 47) error: package com.example.android.transfer does not exist
Error:(19, 9) error: cannot find symbol class ClientData
Error:(19, 25) error: cannot find symbol variable ClientData
Error:Execution failed for task ':Testing:compileDebugJava'.
但在IDE内部一切都很好,我可以看到模块
这也是外部模块
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion '20.0.0'
defaultConfig {
applicationId "com.example.externalmodule"
minSdkVersion 14
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
}
答案 0 :(得分:2)
您的"外部模块"是一个Android库,所以根据Gradle+Android documentation而不是
apply plugin: 'com.android.application'
应该是
apply plugin: 'com.android.library'
// Old version of the plugin
// apply plugin: 'android-library'
此外,请确保您的应用中的导入与您在库构建脚本中覆盖的包匹配。看起来应用程序没有创建com.example.android.transfer
,但库包真的是com.example.externalmodule