5

I have a dummy project, which I succeed to compile through buildship plugin in eclipse IDE.

This is my local.properties file:

sdk.dir=C:/Asta/altro/adt-bundle/sdk

This is settings.gradle file

rootProject.name = 'testgradle'

This is my build.gradle file

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.2'
    }
}

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.example.testgradle"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
        }
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }
    }

    lintOptions {
        abortOnError false
    }
}

sourceCompatibility = 1.6
targetCompatibility = 1.6


repositories {
    jcenter()
    flatDir {
        dirs 'libs'
    }
}

dependencies {
    compile 'org.slf4j:slf4j-api:1.7.21'
    compile 'com.android.support:appcompat-v7:23.4.0'
    testCompile 'junit:junit:4.12'
}

task wrapper(type: Wrapper) {
    gradleVersion = '2.10'
}

Despite I got the apk fully compiled, eclipse is not integrated: still seeing missing libraries and giving more than a 100 errors! All the libs are perfectly managed by gradle in \build\intermediates\ and assembled into apk, but the eclipse IDE is not "live". I would like to use gradle to download and explode the libraries and then to inform eclipse and let it to make the apk with its own builder.

Zanna
  • 676
  • 9
  • 13
  • see [459572 - Support Gradle and the Buildship project and Android Gradle Plugin](https://bugs.eclipse.org/bugs/show_bug.cgi?id=459572) – TmTron Jan 03 '18 at 10:54

1 Answers1

0

Buildship can be used only to run Android tasks (assembleDebug).

During the build process it will load dependencies and tell if there're some errors.

To load dependencies into Java classpath, to see errors in Eclipse and resolve imports you can either manually add .jar files to your Java Build Path or use this Gradle plugin: https://github.com/greensopinion/gradle-android-eclipse.

It generates classpath for Eclipse project and you just import it into the IDE.

To run Gradle tasks you can create a Run configuration (named "Gradle Project") and put there your task and Working directory.

mortalis
  • 2,060
  • 24
  • 34