我正在尝试将我的 Android 项目从 Eclipse 迁移到 Android Studio。我有一个在其他项目中使用的库项目,这就是我希望将其分开(不在项目中复制)的原因。为此,我遵循 this answer 。但我收到以下错误:
Error:Configuration with name 'default' not found.
我阅读并尝试了互联网上针对此错误的所有答案,但没有解决我的问题。
设置.gradle
include ':my_android_app'
include ':my_android_project_lib'
project(':my_android_project_lib').projectDir = new File(settingsDir, '../my_android_project_lib')
my_android_app 模块的 build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "my.android.app"
minSdkVersion 15
targetSdkVersion 19
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile project(path: ':my_android_project_lib')
}
my_android_app 项目的build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
编辑: This answer帮助我解决了问题。我必须将依赖项添加到项目的 build.gradle 文件中。
最佳答案
关于android - 在 Android Studio 上引用库项目而不进行复制 - 错误 :Configuration with name 'default' not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28091831/