Trying to make an Android Studio Application with

2019-02-15 15:18发布

问题:

I've been trying to properly import this library to begin writing an image editing component for my application. I currently have the downloaded 'creativesdk-repo' folder in the root directory, and have followed instructions according to this tutorial: https://creativesdk.adobe.com/docs/android/#/articles/gettingstarted/index.html.

And this tutorial as well: https://creativesdk.adobe.com/docs/android/#/articles/imageediting/index.html

There are no problems building when I simply use the basic authorization library, but my application needs photo editing capability. My foremost problem (among many) lies within the build.gradle file of the application (not the encompassing project build.gradle file).

Here is the code in my build.gradle file:

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'
}

The very last line causes an error message to appear:

Error:Failed to resolve: com.adobe.creativesdk.image:4.0.0: Open File

I believe these messages mean that the image editing portion of the Adobe Creative SDK libraries are not being recognized. I have even tested this with example projects from Adobe and it runs into the same problem. What can I do to fix this and start writing this portion of my application?

回答1:

You need download creative-sdk repo from download links into your project folder. In the project gradle define creative-sdk repo url like this:

    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
        }

    }

}

In your app build.gradle define this:

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

You should extend your Application class and implement this, something like this:

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 "";
    }        

}

In your AndroidManifest.xml inside Application tag put this:

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

With this configuration you can call Aviary Sdk Activity with this:

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

I configure SDK like this, and its working. Sorry for the delay.

UPDATE 10/10/2016:

Thanks to Ash Ryan:

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



回答2:

Use this:

//noinspection SpellCheckingInspection
repositories {
    // ...
    // For Adobe Creative SDK
    maven { url 'https://repo.adobe.com/nexus/content/repositories/releases/' }
}

Source: https://creativesdk.adobe.com/docs/android/#/articles/gettingstarted/index.html



回答3:

Please make sure under global project repo. If not gradle not able to find the path.

allprojects {
    repositories {

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

}


回答4:

I think your error is here. Change:

complie 'com.adobe.creativesdk.image:4.0.0'

for this:

compile 'com.adobe.creativesdk.image:4.0.0'

It`s a simple sintax error.

UPDATE 10/10/2016:

Thanks to Ash Ryan:

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



回答5:

just use latest lib dependency in Module:app build.gradle file and update your android sdk and android studio

compile 'com.adobe.creativesdk:image:4.6.3'