[英]Android, how to import Gradle library into eclipse (ANT)
我正在嘗試使用新的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樣式:),但這並不方便。
我已經對類似問題進行了一些研究-如何在ANT中在Eclipse中使用aar。 最后,我最終下載了Eclipse庫項目(有該選項-選擇aar或Eclipse Library Project),並將其添加到Eclipse中。 除資產外,其他一切工作正常-需要在項目內部復制apk(而非庫)本身。
對於我自己,我不建議在不久的將來使用ANT,因為即使是android開發人員也推遲了對它的支持。 android開發人員站點上有一個功能摘要表(詢問,我將對其進行搜索),很明顯,ANT的支持被推遲了,而Gradle的方向被認為是其中之一。 我不久前搬到Gradle,可以說,它比ANT好得多。 完全沒有依賴項的噩夢。 這非常重要,因為現代庫可以包含數十個依賴項。 手動搜索,添加,版本控制是一場噩夢。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.