我在 Eclipse 中有一个使用库 actionbarsherlock(版本 4.3.1)的现有项目 MyProject。该项目在 android studio 中编译并运行,但我没有得到构建变体。请帮忙!
这是我的根文件夹(project_workspace)的 setting.gradle 和 build.gradle:
// setting.gradle:
include ':MyProject'
include ':actionbarsherlock'
build.grade:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:gradle:0.4'
}
}
myProject 的 build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':C::Users:<myname>:project_workspace:actionbarsherlock')
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
}
}
actionbarsherlock 的 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 14
buildToolsVersion "17.0.0"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
}
}
我也在这里阅读了很多问题和答案,并查看了 gradle 示例,但我不明白。请帮助我,我以前从未使用过 maven 或 ant!如果您需要更多信息 -> 告诉我。