开始时,是的,我知道有多个其他线程具有相同的标题来解决相同的错误,但是在3个完整的工作日后,我无法修复此错误。
项目结构: 的BaseDir / -build.gradle
+App/
+ LibProject1/
-build.gradle
-build.gradle
-settings.gradle
-(code/src/etc..)
+LibProject2/
-build.gradle
+LibProject3/
-build.gradle
的BaseDir /的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.5.0'
}
}
allprojects {
repositories {
jcenter()
}
}
Settings.gradle:
include: ":App:LibProject1"
include: ":LibProject2"
include: ":Libproject3"
应用/的build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}
allprojects {
repositories {
jcenter()
}
}
apply plugin: 'com.android.application'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(":Copy:CordovaLib")
compile project(':LogManagerAndroidProject')
compile project(':XBDSInterfaces')
}
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
}
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
Library1,2,3 /的build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}
apply plugin: 'com.android.library'
android{
compileSdkVersion 19
buildToolsVersion "19.1.0"
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}
*原谅发布中的奇怪格式,我还没有正确发布代码块。
我收到的错误发生在我的所有图书馆中。我重新组织了哪些库首先在app / build.gradle文件中编译,它从未传递第一个编译项目行。哪个libproject首先被编译,抛出Cannot evaluate module : defualt not found
错误。
所有其他主题告诉我:
1)确保您的库文件夹具有build.gradle文件
2)在build.gradle文件中有一个defaultConfig
3)确保您的settings.gradle文件
中的include语句正确无误以及更多相同的内容。
我确保我的所有gradle文件都正确,检查了spellng等。 不知道该怎么做,错误是我偶尔遇到的最简单的通知,任何帮助都会受到重视!
答案 0 :(得分:0)
我对此问题的解决方案是我有多个settings.gradle文件。确保在根目录中只有一个。 这个多项目构建的目录结构没有很好地规划,并且已经设置在我的大腿上进行清理。
对于未来的读者,Android Studio并不像eclipse那样对待多项目构建。这是我的根本错误。