android-studio - 尝试使用 Adob​​e Creative SDK 图像编辑制作 Android Studio 应用程序,无法在 gradle 中编译库

标签 android-studio build.gradle aviary adobecreativesdk

我一直在尝试正确导入此库,以开始为我的应用程序编写图像编辑组件。我目前在根目录中有下载的“creativesdk-repo”文件夹,并根据本教程按照说明进行操作: https://creativesdk.adobe.com/docs/android/#/articles/gettingstarted/index.html .

还有本教程: https://creativesdk.adobe.com/docs/android/#/articles/imageediting/index.html

当我简单地使用基本授权库时构建没有问题,但我的应用程序需要照片编辑功能。我最重要的问题(在许多问题中)在于应用程序的 build.gradle 文件(而不是包含的项目 build.gradle 文件)。

这是我的 build.gradle 文件中的代码:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.0"

    defaultConfig {
        applicationId "com.example"
        minSdkVersion 14
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.0.0'
    compile 'com.adobe.creativesdk.foundation:auth:0.3.94'
    compile 'com.adobe.creativesdk.image:4.0.0'
}

最后一行导致出现错误消息:

错误:解析失败:com.adobe.creativesdk.image:4.0.0: 打开文件

我认为这些消息意味着 Adob​​e Creative SDK 库的图像编辑部分未被识别。我什至用 Adob​​e 的示例项目对此进行了测试,它遇到了同样的问题。我该怎么做才能解决这个问题并开始编写我的应用程序的这一部分?

最佳答案

您需要从下载链接将 creative-sdk 存储库下载到您的项目文件夹中。在项目 gradle 中,像这样定义 creative-sdk repo url:

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

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

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

    }

}

在您的应用程序 build.gradle 中定义:

  compile 'com.adobe.creativesdk.foundation:auth:0.3.94'
  compile 'com.adobe.creativesdk:image:4.0.0'

您应该扩展您的 Application 类并实现它,如下所示:

public class ExampleApplication extends MultiDexApplication implements IAdobeAuthClientCredentials , IAviaryClientCredentials {
    private static final String CREATIVE_SDK_SAMPLE_CLIENT_ID = "62bbd145c3f54ee39151823358c83e28";
    private static final String CREATIVE_SDK_SAMPLE_CLIENT_SECRET = "2522a432-dfc8-40c4-94fe-646e10223562";        

    @Override
    public void onCreate() {
        super.onCreate();       
        AdobeCSDKFoundation.initializeCSDKFoundation(getApplicationContext());

    }

    @Override
    public String getClientID() {
        return CREATIVE_SDK_SAMPLE_CLIENT_ID;
    }

    @Override
    public String getClientSecret() {
        return CREATIVE_SDK_SAMPLE_CLIENT_SECRET;
    }

    @Override
    public String getBillingKey() {
        return "";
    }        

}

在你的 AndroidManifest.xml 里面的 Application 标签里放这个:

 <provider
            android:name="com.aviary.android.feather.sdk.internal.cds.AviaryCdsProvider"
            android:authorities="com.package.AviaryCdsProvider"
            android:exported="false"
            android:process=":aviary_cds" />

使用此配置,您可以调用 Aviary Sdk 事件:

 Intent newIntent = new AviaryIntent.Builder(this);
//config values
startActivity(newIntent);

我像这样配置 SDK,它的工作。抱歉耽搁了。

2016 年 10 月 10 日更新:

感谢 Ash Ryan:

Trying to make an Android Studio Application with Adobe Creative SDK Image Editing, cannot get libraries compiled in gradle

关于android-studio - 尝试使用 Adob​​e Creative SDK 图像编辑制作 Android Studio 应用程序,无法在 gradle 中编译库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29532920/

相关文章:

java - 用户登录 Android Studio 后如何将应用程序打开到不同的 Activity

android-studio - 如何仅使用 Android Studio git 插件 GUI 对齐 git 工作副本

java - 从 `build.gradle`获取值到代码

android - Aviary 返回的图像尺寸小于原始尺寸

android-studio - 是否可以在 Intellij IDE (Android Studio) 中显示堆内存大小?

android - 安装的 Build Tools 版本 28.0.3 已损坏。如何修复此错误

android-studio - 将 swagger-codegen 项目导入现有的 Android 项目

android - formString(System.getenv ("...")) 是什么意思?

ios - 鸟舍整合问题

c# - MonoTouch "unrecognized selector sent to instance"不适用于 iOS5(但适用于 iOS6)