我正在尝试使用新的 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.
我的项目中已经有这个文件: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/