Android 添加 Adob​​e Creative SDK 时 Studio 出错

Android Studio Error when adding Adobe Creative SDK

这是我的 build.gradle 文件。 我已遵循 this 教程。

repositories {
    mavenCentral()
    jcenter()
    mavenLocal()
    maven {
        url "${project.rootDir}/mvn-repo/release" //ADD THE CORRECT LOCATION OF THE CREATIVESDK LIBRARY FILES
    }
}

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

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

    defaultConfig {
        applicationId "com.example.test"
        minSdkVersion 11
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':libraries:collage-views')
    compile 'com.aviary.android.feather.sdk:aviary-sdk:3.6.5'
    compile 'com.adobe.creativesdk:behance:0.2.10'
    compile 'com.adobe.creativesdk:image:4.0.0'

    // Support libraries
    compile 'com.android.support:support-v4:21.0.3'
}

我遇到了这个错误

Error:Failed to find: com.adobe.creativesdk:behance:0.2.10 Open File
Open in Project Structure dialog

Error:Failed to find: com.aviary.android.feather.sdk:aviary-sdk:3.6.5 Open File
Open in Project Structure dialog

Error:Failed to find: com.adobe.creativesdk:image:4.0.0 Open File
Open in Project Structure dialog

我需要给出 ${project.rootDir}/mvn-repo/release 的路径吗 或者需要下载 sdk 并手动将其添加到某个地方? 我是android工作室的新手,所以不太了解

我已经下载了 Adobe Creative SDK 并将其放入工作区的项目文件夹中。文件夹名称是 "creativesdk-repo"。 将 build.gradle 文件中的 URL 更改为:

url "${project.rootDir}/creativesdk-repo"

(或任何文件夹名称)

同步 build.gradle 文件,它可以正常工作。

不要忘记添加这个..

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

将下载的sdk放入根目录,添加

maven {
         url "${project.rootDir}/creativesdk-repo"//your sdk name as it is
      } 

在 "allprojects/repositories" 部分下应用程序的 build.grade 文件中:如下

allprojects {
    repositories {
        mavenCentral()
        jcenter()

        maven {
            url "${project.rootDir}/creativesdk-repo" 
        }
    }
}

确保将打包选项添加到应用程序 build.grade 文件的 "android" 部分下:

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