Tuesday, October 27, 2015

android studio exists with eclipse adt project in same folder

what:
 our old android project is desiged by eclipse with android developer tools(adt),now,we want to used android studio ide to open it.but other co-workers want to used eclipse in same project.

how:
create one build.gradle in eclipse android project:


// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

/////////////////////////////////////////////////////////////////////////////////////////

apply plugin: 'com.android.application'
android {
    compileSdkVersion 22
    buildToolsVersion "23.0.1"
    defaultConfig {
        applicationId "com.your.application.package"        minSdkVersion 10
        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']
            jniLibs.srcDirs = ['libs']
        }

//         instrumentTest.setRoot('tests')
    }
    
    buildTypes {
        release {
            minifyEnabled true            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
}



////////////////////////////////////////////////////////////////////
After:
we only add build.gradle with vcs(git,svn). can ignore:
.gradle\
.idea\
bin\
build\
gen\
gradle\
proguard\
*.iml
gradlew
gradlew.bat
local.properties

No comments: