2015-10-28 101 views
0

有誰知道gradle腳本來編譯eclipse項目格式的android項目。我知道你可以將它們轉換爲工作室,但這可能是大量工作,並且我有許多項目正在運行maven。我想只是使用腳本來編譯我的eclipse android項目,因爲他們使用gradle。由於gradle非常靈活,我認爲沒有理由不應該爲eclipse項目做好準備。但是那裏?是否有一個gradle腳本來編譯eclipse的android項目?

+0

在android studio中打開項目,它自己做所有事情 – Prakhar

+0

閱讀問題Prakhar。然後upvote我的答案。 – MuayThai

回答

0

是存在,不是一個怪胎我不會保持它自己: 名該文件的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

相關問題