无法解析Android Studio中的依赖项
我真的被这件事困住了:无法解析Android Studio中的依赖项,android,gradle,Android,Gradle,我真的被这件事困住了: 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
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 {
}
您的“外部模块”是一个Android库,因此根据
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
“外部模块”是一个Gradle项目吗?它是在父设置.gradle上定义的吗?你的目录树怎么样?@RobertEstivill是的,这是一个Gradle项目。是,在settings.gradle中定义它。所有文件都在同一级别外部模块是java库吗?安卓库?它会覆盖包吗?你能贴出整个目录树的图片吗?Thanks@RobertEstivill外部模块是Android模块。这不是真正的目录树,这只是Android Studio的“Android视图”,它根据Android应用程序目录结构对内容进行分组。请添加外部模块gradle build。感谢您的努力,现在我可以睡觉了:)它工作了它是android库