试图将项目导入到Android Studio中0.2.9的时候,我发现了以下错误:
Could not execute build using Gradle distribution
'http://services.gradle.org/distributions-snapshots/
gradle-1.8-20130830160653+0000-bin.zip'.
A problem occurred configuring project ':library'.
A problem occurred configuring project ':library'.
Failed to notify project evaluation listener.
Neither path nor baseDir may be null or empty
string. path='' basedir='/
drag-sort-listview/library'
Consult IDE log for more details (Help | Show Log)
该项目原本是Maven项目(1)。我在Eclipse ADT中打开它,根据(2)的说明生成了一个/librabry/build.gradle文件。
在Eclipse ADT生成build.gradle看起来像:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android-library'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
android {
compileSdkVersion 7
buildToolsVersion "17.0.0"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['']
resources.srcDirs = ['']
aidl.srcDirs = ['']
renderscript.srcDirs = ['']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
}
}
我不得不从
classpath 'com.android.tools.build:gradle:0.4'
改线6
classpath 'com.android.tools.build:gradle:0.5+'
让Android Studio中不再说版本错过了匹配。我还添加了/settings.gradle文件,其中包含
include ':library'
和/local.properties文件与内容
# This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
sdk.dir=/Applications/Android Studio.app/sdk
然后我试图通过“文件中选择要导入的文件/settings.gradle |导入项目...“对话框。我在对话框(3)中勾选'使用自动导入'选项并选择'使用gradle wrapper with verification'选项。 (4)可查看完整的idea.log条目。
任何帮助将不胜感激,谢谢。
2013-09-23
nrser