gradle构建期间的Aviary-SDK错误(Android)

时间:2016-02-22 13:25:05

标签: java android gradle adobecreativesdk

我复制了Aviary设置指南的每一步。在Gradle构建期间,它给了我:

  

错误:未找到名称为“default”的配置。

安装指南:

Adobe Creative SDK Documentation
Aviary SDK | Android Documentation

档案:

settings.gradle:

include ':app'

build.gradle(Module:app)



apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.adobe.logopros"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }

}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:22.2.1'
    compile 'com.android.support:design:22.2.1'
    compile 'com.adobe.creativesdk.foundation:auth:0.7.329'
    compile 'com.adobe.creativesdk:image:4.0.0'
}


2 个答案:

答案 0 :(得分:1)

快速旁注:以上链接的Aviary SDK文档已被删除。)

更新:版本0.9.7

的说明

Creative SDK图像编辑器(以前称为Aviary)现在作为远程Maven仓库提供。本节是有关配置gradle的更新说明。

项目 build.gradle中,添加以下代码(请参阅评论):

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'

        /* 1) Add the Gradle Retrolambda Plugin */
        classpath 'me.tatarka:gradle-retrolambda:3.3.0-beta3'

    }
}

allprojects {
    repositories {
        jcenter()

        /* 2) Add mavenCentral */
        mavenCentral()

        /* 3) Add the Creative SDK Maven repo URL */
        maven {
            url 'https://repo.adobe.com/nexus/content/repositories/releases/'
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

模块 build.gradle中,添加以下代码(请参阅评论):

apply plugin: 'com.android.application'

/* 1) Apply the Gradle Retrolambda Plugin */
apply plugin: 'me.tatarka.retrolambda'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.adobe.gettingstarted"
        minSdkVersion 16 // Minimum is 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    /* 2) Compile for Java 1.8 or greater */
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    /* 3) Exclude duplicate licenses */
    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/DEPENDENCIES'
        pickFirst 'AndroidManifest.xml'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'

    /* 4) Add the CSDK framework dependencies (Make sure these version numbers are correct) */
    compile 'com.adobe.creativesdk.foundation:auth:0.9.7'
}

详情请参阅Creative SDK for Android Getting Started guide

0.7.329及以下

的旧说明

您的模块 build.gradle看起来不错。您还需要一个 Project build.gradle文件:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        mavenCentral()
        maven {
            url "${project.rootDir}/creativesdk-repo/release" // Location of the CSDK repo
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

this section the Creative SDK Getting Started guide for Android中介绍了两种gradle.build配置之间的差异,包括上面的代码。

答案 1 :(得分:1)

使用Gradle,使用Aviary进行设置非常简单。仅当您不打算自定义SDK时,才使用此方法。否则,您需要在项目目录中将SDK添加为自己的模块。有关此内容的深入演练,请参阅第4.2节。

首先,在Android Studio中打开Application的build.gradle文件。请注意,这与根项目的build.gradle文件不同。

确保在存储库块中,您同时拥有Maven Central和Aviary的Maven存储库。看起来应该是这样的:

repositories {
    mavenCentral()
    jcenter()
    mavenLocal()
    maven {
        name 'maven.aviary.com'
        url uri("http://maven.aviary.com/repo/release")
    }
}

在同一个文件中,将以下内容添加到依赖项块中,以便使用Aviary SDK构建项目:

compile 'com.aviary.android.feather.sdk:aviary-sdk:3.6.3'

最后,在android块中的packagingOptions中,添加以下内容以防止重复复制这些文件:

exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE.txt'

以下是build.gradle文件的外观示例:

repositories {
    mavenCentral()
    jcenter()
    mavenLocal()
    maven {
        name 'maven.aviary.com'
        url uri("http://maven.aviary.com/repo/release")
    }
}

android {
    compileSdkVersion 20
    buildToolsVersion "20.0.0"

    defaultConfig {
        minSdkVersion 10
        targetSdkVersion 20
        versionCode 1
        versionName "1.0"
    }

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

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    packagingOptions {
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/LICENSE.txt'
    }

}

dependencies {
    compile 'com.aviary.android.feather.sdk:aviary-sdk:3.6.3'
}

(请注意,minSdkVersion为10。)