[英]Is there a gradle script to compile eclipse android project?
Does anyone know of gradle script to compile android projects in eclipse project format. 有谁知道gradle脚本以eclipse项目格式编译android项目。 I know you can convert them over to studio, but this can be tons of work and I have many projects runnning off maven.
我知道您可以将其转换为工作室,但这可能需要大量工作,而且我有许多项目都在行家中进行。 i would like to just use a script to compile my eclipse android projects as they are using gradle.
我只想使用脚本来编译我的Eclipse Android项目,因为它们正在使用Gradle。 Since gradle is so flexible, I see no reason there should not be a ready made one for eclipse project?
由于gradle非常灵活,我认为没有理由不应该为Eclipse项目准备现成的东西吗? But is there?
但是在那里吗?
yes there is, not being a geek I won't keep it to myself: name this file build.gradle and put in the root of your eclipse project directory: 是的,这里有,不是一个极客,我不会对自己保密:将这个文件命名为build.gradle并放在eclipse项目目录的根目录中:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.4.0'
}
}
apply plugin: 'com.android.application'
android {
lintOptions {
abortOnError false
}
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
targetSdkVersion 22
}
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 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')
}
}
And I will give credit to: http://www.vogella.com/tutorials/AndroidBuild/article.html#building_gradle 我要感谢: http : //www.vogella.com/tutorials/AndroidBuild/article.html#building_gradle
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.