我正在一个项目中工作,最初是在Eclipse中开始的。然后我迁移到了Android Studio。
我在Mac上工作,一切都很好。 但是,当我尝试在我的PC上下载Git仓库时,我收到了这个消息:
Configuration with name 'default' not found
这是我的项目组织结构:
SP-Mobile
progressWheel ( Lib as a project )
sPMobile ( Main Project )
build.gradle (1)
build.gradle (top)
settings.gradle (top)
build.gradle (1)
apply plugin: 'com.android.application'
android {
compileSdkVersion 'Google Inc.:Google APIs:21'
buildToolsVersion "21.1.2"
lintOptions {
abortOnError false
}
defaultConfig {
applicationId "com.spmkt.mobile"
minSdkVersion 16
targetSdkVersion 22
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
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 project(':progressWheel')
compile 'com.google.code.gson:gson:2.3'
compile 'com.google.android.gms:play-services:+'
compile 'com.android.support:appcompat-v7:22.2.0'
compile files('libs/crashlytics.jar')
compile files('libs/httpcore-4.3.2.jar')
compile files('libs/httpmime-4.3.3.jar')
build.gradle (顶层)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
}
}
allprojects {
repositories {
jcenter()
}
}
最后是settings.gradle。
include ':progressWheel'
include ':sPMobile'
我做了一些测试,当我移除对progressWheel的依赖后,就不再有问题了(代码无法编译,但同步成功)。
我想我的问题来自于这行代码:
compile project(':progressWheel')
但我不明白为什么在一个电脑上一切正常,而另一个电脑就失败了!
编辑: 看来progressWheel就像一个模块被添加进去了,但sPMobile没有。
progressWheel里面有一个 .iml 文件,但 sPMobile 没有。
编辑2:
看起来我的 SP-Mobile.iml 是红色的,我不知道这是什么意思,但我的 iml 的 lib 不是红色的,所以我可以理解 mac 和 pc 之间的差异...
这是我的 .iml 项目
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="SP-Mobile"
external.linked.project.path="$MODULE_DIR$"
external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE"
external.system.module.group="" external.system.module.version="unspecified"
type="JAVA_MODULE" version="4">
任何帮助都将不胜感激!