Android,如何将Gradle库导入eclipse(ANT)

时间:2014-12-18 03:29:38

标签: java android adobe aviary

我正在尝试使用新的Abode Creative SKD,但使用Eclipse而不是Android Studio。

如何在我的eclipse项目中添加以下库:

4.1 Adding the library dependency
In the build.gradle file of the app add the required library as a dependency.
EX: If you need to use authentication library you will need to add the below path under dependencies:
compile 'com.adobe.creativesdk.foundation:auth:0.2.10'
You can choose all or any of this according to your project requirements:
Authentication : 'com.adobe.creativesdk.foundation:auth:0.2.10'
Asset Browser : 'com.adobe.creativesdk.foundation:assets:0.2.10'
Behance : 'com.adobe.creativesdk:behance:0.2.10'
Image : 'com.adobe.creativesdk:image:4.0.0'
Note: com.adobe.creativesdk.foundation:auth is a basic requirement for any of the libraries.

from this link

我的项目中已有此文件:build:grade

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0'
    }
}


allprojects {
    apply plugin: 'maven'

    tasks.withType(JavaCompile) {
        options.incremental = true
    }

    repositories {
        mavenCentral()
        jcenter()

        maven {
            url "${project.rootDir}/creativesdk-repo"  //ADD THE CORRECT LOCATION OF THE CREATIVESDK LIBRARY FILES
        }

    }
}

apply plugin: 'android'

dependencies {
    compile fileTree(include: '*.jar', dir: 'libs')
    compile 'com.adobe.creativesdk:behance:0.2.10'
    compile 'com.adobe.creativesdk.foundation:auth:0.2.10'
    compile 'com.adobe.creativesdk.foundation:assets:0.2.10'
}

android {
    compileSdkVersion "android-21"
    buildToolsVersion "21.1.1"

    defaultConfig {
        applicationId "com.adobe.creativesdk.sample"
        minSdkVersion 14
        targetSdkVersion 21
        versionName "1.0.0"
        versionCode 1
    }

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

    buildTypes {
        release {
            debuggable false
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
    }

    lintOptions {
        abortOnError false
    }
}

1 个答案:

答案 0 :(得分:0)

使用ANT?没门。当然,您可以解压缩aar,在Abode Creative SKD中找到并放置文件以便ANT可以使用它们。您甚至可以使用该文件创建一个库项目并包含它(ANT样式:)但它不方便。

我已经对simular问题做了一些调查 - 如何在Eclipse中使用ANT和ANT。我最终最终下载了Eclipse库项目(有选择 - 选择aar或Eclipse Library Project)并在Eclipse中添加它。所有工作都很好,除了资产 - 他们需要在项目内复制apk(而不是库)本身。

从我自己来看,我不建议在不久的将来使用ANT,因为即使Android开发者也推迟了它的支持。 Android开发者网站上有一个功能汇总表(请问我会搜索它),很明显ANT的支持被推迟,而Gradle方向优先。我不久前搬到了Gradle,我可以说,它比ANT好多了。根本没有依赖的噩梦。这非常重要,因为现代图书馆可以包含数十个依赖项。手工搜索,添加和版本化是一场噩梦。