【发布时间】:2014-07-01 15:31:49
【问题描述】:
我从 Eclipse 迁移到 android studio 0.5.8,将我的项目导入到 android studio 后,我收到错误 Project with path ':progressfragment' could not be found in root project 'project_name'.
项目结构:
库
完整结构(编辑 2):
Gradle.build:
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':progressfragment')
compile project(':viewpagerindicatorlibrary')
compile project(':ZBarScannerActivity')
compile project(':google-play-services_lib')
compile project(':SwitchCompatLibrary')
compile project(':actionbarsherlock')
compile project(':librarymultichoice')
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
android {
compileSdkVersion 14
buildToolsVersion "19.0.1"
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')
}
}
【问题讨论】:
-
你没有
settings.gradle文件吗? -
@Salem 不,我没有
-
问题不清楚,请附上完整的项目结构,这个 gradle 文件在哪里以及项目目录结构是什么样的,因为你给的东西根本不像一个 gradle 项目。
-
@pyus13 问题已编辑
-
除了 build.gradle 之外,没有什么像 gradle 项目。从 AS 的 botton panel 打开 Message Window 并确保它没有显示像 "Not a Gradle Project" 这样的警告消息。
标签: android eclipse android-studio