java - Android,如何将Gradle库导入到eclipse中(ANT)

标签 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
    }
}

最佳答案

使用 ANT?决不。当然,您可以解压在 Abode Creative SKD 中找到的 aar,然后放置这些文件,以便 ANT 可以使用它们。您甚至可以使用该文件创建一个库项目并将其包含在内(ANT 风格:),但这很不方便。

我已经对类似问题进行了一些调查 - 如何在 Eclipse 中使用 ANT 的 aar。我最终下载了 Eclipse 库项目(有这个选项 - 选择 aar 或 Eclipse 库项目)并将其添加到 Eclipse 中。除了 Assets 之外,所有工作都正常 - 它们需要在 apk(而不是库)本身的项目中复制。

就我个人而言,我不建议在不久的将来使用 ANT,因为即使是 Android 开发人员也推迟了对它的支持。 Android 开发者网站上有一个功能汇总表(询问,我会搜索它),其中很明显对 ANT 的支持被推迟,而 Gradle 方向是首选。不久前我搬到了 Gradle,我可以说,它比 ANT 好得多。根本没有依赖的噩梦。这非常重要,因为现代库可以包含数十个依赖项。手动搜索、添加、版本控制它们是一场噩梦。

关于java - Android,如何将Gradle库导入到eclipse中(ANT),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27538806/

相关文章:

java - 如何从 XPath 中删除所有选定的节点?

Java for 循环优化

javascript - 在html5中调用onclick按钮的函数

android - MaterialDatePicker获取所选日期

c++ - 使用 C++ 从 *.fla 导出 *.png 序列

php - 用 Flash 和 PHP 编写视频聊天小部件

java - 使用 Apache HTTP 客户端将 Tomcat Web 应用程序的 keystore 放在哪里

java - 如何查找一个类的所有参数及其类型?

java - NullPointerException:键== null ||值==空

2020 年后的 Flash Player 投影仪