How to migrate eclipse project to android


(devwhr) #1

I try migration from eclipse to gradle. I have 4 projects. First project is root. Code: settings.gradle include ‘:DataDroid’,’:nifty’,’:google-play-services_lib’,’:ActionBarSherlock’,’:OneTouchToLunch’ I try use for app apply plugin: ‘android’ and for libs apply plugin: ‘android-library’

what is wrong. I have compail, but not work in the my android emulator root gradle.build

buildscript {
  repositories {
    mavenCentral()
  }
    dependencies {
    classpath 'com.android.tools.build:gradle:0.5.0'
  }
}
subprojects {
  repositories { mavenCentral() }
  version = '1.0'
 project(':ActionBarSherlock'){}
 project(':DataDroid'){}
 project(':nifty'){}
 project(':google-play-services_lib'){}
}
Primary:
buildscript {
  repositories {
    mavenCentral()
  }
    dependencies {
       classpath 'com.android.tools.build:gradle:0.5.0'
  }
}
apply plugin: 'android'
      dependencies {
    compile files('libs/flexjson-2.1.jar')
    compile files('libs/ormlite-android-4.45.jar')
    compile files('libs/ormlite-core-4.45.jar')
}
project(':OneTouchToLunch'){
     dependencies {
     compile project(':ActionBarSherlock'), project(':DataDroid'), project(':nifty'), project(':google-play-services_lib')
  }
}
  task wrapper(type: Wrapper) {
    gradleVersion = '1.6'
}
    android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"
    defaultConfig {
        minSdkVersion 7
        targetSdkVersion 16
    }
    sourceSets {
        main {
            manifest {
                srcFile 'AndroidManifest.xml'
  srcFile '../ActionBarSherlock/actionbarsherlock/AndroidManifest.xml'
  srcFile '../DataDroid/AndroidManifest.xml'
  srcFile '../google-play-services_lib/AndroidManifest.xml'
  srcFile '../nifty/AndroidManifest.xml'
            }
            java {
                srcDir 'res/**'+ 'src/**'
              }
            res {
                srcDir 'res/**'
            }
                assets {
                srcDir 'assets'
                 }
      resources {
                srcDir 'res/**'
             }
     aidl{
  srcDirs 'src/**'
  }
     renderscript{
  srcDirs
'src/**'
  }
     }
      test {
         java {
   srcDir 'tests/src'+'src/**'
       }
    }
    }
}

Secondary for example:

buildscript {
  repositories {
    mavenCentral()
  }
    dependencies {
    classpath 'com.android.tools.build:gradle:0.5.0'
  }
}
apply plugin: 'android-library'
  repositories {
  mavenCentral()
}
  dependencies {
    compile 'com.android.support:support-v4:13.0.+'
//
compile files('actionbarsherlock/libs/android-support-v4.jar')
}
    task wrapper(type: Wrapper) {
    gradleVersion = '1.6'
}
  android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"
    defaultConfig {
        minSdkVersion 7
        targetSdkVersion 16
    }
    sourceSets {
        main {
         manifest {
              srcFile 'actionbarsherlock/AndroidManifest.xml'
          }
          java {
              srcDir 'actionbarsherlock/src'
          }
          res {
              srcDir 'actionbarsherlock/res'
          }
          assets {
              srcDir 'actionbarsherlock/assets'
          }
          resources {
              srcDir 'actionbarsherlock/src'
          }
   renderscript{
              srcDir 'actionbarsherlock/src'
          }
   aidl{
              srcDir 'actionbarsherlock/src'
          }
                     }
             }
}