我一直在與Android Studio for Dayys爭鬥,因爲我無法在IDE中導入2個eclipse項目。在這裏我已經完成了。如何在Android Studio中正確導入Android項目?
這些項目是2個Eclipse項目,我通過執行FILE> EXPORT> Generate build.gradle文件導出它們。
當我嘗試導入Android Studio中的項目,我有這樣的錯誤:
Failed to refresh Gradle project 'SourceFiles'
You are using Gradle version 1.11, which is not supported. Please use version 1.9.
Please point to a supported Gradle version in the project's Gradle settings or in the project's Gradle wrapper (if applicable.)
Fix Gradle wrapper and re-import project Gradle settings
正如你看到我的gradle使用的最新分佈(1.11版),它仍然無法正常工作。 有人可以告訴我在Android Studio中導入這些項目的正確方法嗎?
我對 在Linux OpenSUSE 13.1版本的Android 工作室:0.4.2 的Java:1.7
[編輯]我的項目是由包含2子目錄Skeletons
和Testcase
目錄Sourcefiles
的。 Skeletons
包含源文件,TestCase
包含與Skeletons
中項目關聯的測試用例。
下面是Eclipse生成所述的build.gradle: 在SourceFiles
級別:
task wrapper(type: Wrapper) {
gradleVersion = '1.9'
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
在骨架水平:
android {
compileSdkVersion 18
buildToolsVersion "19.0.2"
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')
}
}
在測試用例級別目錄:
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':Skeletons:FragmentsLab')
}
android {
compileSdkVersion 18
buildToolsVersion "19.0.2"
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')
}
}
我也必須承認,我仍然是gradle中的noob。 我還更新了加拿大金絲雀頻道的Android Studio最新版本,並在我的項目中引用了gradle的verison 1.9。 任何幫助,將不勝感激。
我想使用Eclipse IDE,但它不斷崩潰。
的價值,你是否嘗試安裝版本1.9? –
根據http://tools.android.com/recent *「Studio中的新導入程序是將項目遷移到Gradle的首選方式」* - 嘗試直接導入eclipse項目比從Eclipse導出效果更好。 – zapl
爲什麼我應該在版本爲1.11時安裝版本1.9? – Dimitri