注意:我不能发布链接,所以我想你需要去这里关注参考。对不起,不是我的规则。
尝试将项目导入 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='<projects folder>/
drag-sort-listview/library'
Consult IDE log for more details (Help | Show Log)
该项目最初是一个 Maven 项目 (1)。我在 Eclipse ADT 中打开它,/librabry/build.gradle
按照 (2) 中的说明生成了一个文件。
生成的 Eclipse ADTbuild.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')
}
}
我不得不将第 6 行从
classpath 'com.android.tools.build:gradle:0.4'
至
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 包装器”选项。完整idea.log
条目可在 (4) 处查看。
任何帮助将不胜感激,谢谢。