1

Hello i build an android app using gradle in eclipse. I allways build the project in command line using gradle. Now i try to build and run it in eclipse on android device emulator. In eclipse i don't know how can i build the project with gradle an run it on android emulator device. Please i need help. You can find my buil.gradle file bellow

apply plugin: 'android'


dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile project(':appcompat_v7')
    compile "org.igniterealtime.smack:smack-android:4.1.0-rc1"
    compile "org.igniterealtime.smack:smack-tcp:4.1.0-rc1"
    // optional features
    compile "org.igniterealtime.smack:smack-android-extensions:4.1.0-rc1"
}

repositories {
  maven {
    url 'https://oss.sonatype.org/content/repositories/snapshots'
  }
  mavenCentral()
}

android {


    lintOptions{
        abortOnError false
    }


    compileSdkVersion 21
    buildToolsVersion "20.0.0"

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 21
    }

    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 tests to tests/java, tests/res, etc...
        instrumentTest.setRoot('tests')

        // 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')
    }
}
angel
  • 104
  • 12
  • 2
    I don't think Eclipse supports gradle. Why don't you use Android Studio? – nasch Jul 06 '15 at 02:39
  • i'm familiar with eclipse (I use it for android development since about 2 years without gradle) but i thank that i will use android studio. Do you think that Studio is better than eclipse for android development ? @nasch – angel Jul 06 '15 at 03:05
  • 2
    Yes, for one thing Eclipse ADT is deprecated and Google isn't developing it any more. Second, as you have discovered gradle is great and integrated with Android Studio. I didn't have any trouble making the transition and I think it's at least as good an IDE if not better. It does have the same memory issues as Eclipse though. – nasch Jul 06 '15 at 04:38

1 Answers1

0

Did you try adding the gradle eclipse plug-in

apply plugin: "eclipse"

And then generate the eclipse project from build.gradle by calling

gradle eclipse

You also should install the "Gradle IDE Pack" from the eclipse marketplace (Help -> Eclipse Marketplace...).

Jens
  • 241
  • 2
  • 9