Android Studio:如何在Jenkins上创buildbuild.gradle文件?

我是新来的gradle,并试图找出如何设置在我们的Jenkins生成机器上。 我们的应用程序可以在Android Studio中完美构build,但是它不会生成build.gradle文件,我相信我需要运行Jenkins上的gradle构build。

任何帮助感激!

Solutions Collecting From Web of "Android Studio:如何在Jenkins上创buildbuild.gradle文件?"

我最终从头开始创build这些构build文件。

以下是一些指导原则:

  1. 如果您有一个包含多个模块的项目,请在项目的根目录(与所有模块处于同一级别)创build一个settings.gradle文件。 您的settings.gradle文件应该如下所示:

    include 'ActionBarSherlock' include ':facebook-android-sdk-3.0.1:facebook' include 'google-play-services_lib' include ':SlidingMenu-master:library' include 'Tinder' include 'ViewPagerIndicator' include 'volley' include 'windowed-seek-bar' 
  2. 在每个模块中,创build一个build.gradle文件。 对于图书馆项目,你的build.gradle文件应该是这样的:

     buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.4.2' } } apply plugin: 'android-library' dependencies { compile 'com.android.support:support-v4:13.0.0' } android { buildToolsVersion "17.0" compileSdkVersion 17 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') } } 
  3. 对于你的主项目,你的build.gradle文件应该是这样的:

     buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.4.2' } } apply plugin: 'android' dependencies { compile project(':facebook-android-sdk-3.0.1:facebook') compile project(':google-play-services_lib') compile project(':SlidingMenu-master:library') compile project(':ViewPagerIndicator') compile project(':volley') compile project(':windowed-seek-bar') compile files('compile-libs/androidannotations-2.7.1.jar', 'libs/Flurry_3.2.1.jar', 'libs/google-play-services.jar', 'libs/gson-2.2.4.jar', 'libs/picasso-1.1.1.jar') } android { buildToolsVersion "17.0" compileSdkVersion 17 sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] } } }