繁体   English   中英

是否有gradle脚本来编译eclipse android项目?

[英]Is there a gradle script to compile eclipse android project?

有谁知道gradle脚本以eclipse项目格式编译android项目。 我知道您可以将其转换为工作室,但这可能需要大量工作,而且我有许多项目都在行家中进行。 我只想使用脚本来编译我的Eclipse Android项目,因为它们正在使用Gradle。 由于gradle非常灵活,我认为没有理由不应该为Eclipse项目准备现成的东西吗? 但是在那里吗?

是的,这里有,不是一个极客,我不会对自己保密:将这个文件命名为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')
 }
} 

我要感谢: http : //www.vogella.com/tutorials/AndroidBuild/article.html#building_gradle

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM