问题
I'm having trouble getting Android Studio to find Adobe Creative SDK in my app. When I try to build and run my app I get errors.
Here is my code for build.gradle (Module: app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.achins.myapplication"
minSdkVersion 17
targetSdkVersion 23
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'
exclude 'META-INF/NOTICE'
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.adobe.creativesdk.foundation:auth:0.5.3'
compile 'com.adobe.creativesdk:image:4.0.0'
}
I get the following errors:
failed to resolve : 'com.adobe.creativesdk.foundation:auth:0.5.3'
failed to resolve : 'com.adobe.creativesdk:image:4.0.0'
回答1:
New setup
The Adobe Creative SDK is now offered as a remote Maven repo.
The gradle setup is covered in the Getting Started guide.
You can also see functioning gradle code in any of the example Android repos on GitHub. For example, with the Image Editor repo, see:
build.gradle
app/build.gradle
Old setup
Note: this is only for legacy versions of the Creative SDK that were available via direct download. For current versions, use the New setup instructions above.
In order to tell the app where Adobe Creative SDK is in your app's file structure, you'll want to provide the path to the SDK in your build.gradle file.
Here is an example:
allprojects {
repositories {
mavenCentral()
jcenter()
maven {
url "${project.rootDir}/creativesdk-repo/release" // ADD THE CORRECT LOCATION OF THE CREATIVESDK LIBRARY FILES
}
}
}
In the above example, the url path starts at the root directory of the app and looks for a directory called creativesdk-repo, then within that, a directory called release.
(If you have added Creative SDK to another location in your app, you will want to edit the url above to point to the right place.)
When the maven url is correct, your com.adobe.creativesdk... dependencies should work. Just be sure you are providing the right version numbers for each part of Creative SDK that you are using!
回答2:
As of 26/07/2016 Adobe has a public repository that can be used instead of having to host it on our local source code.
A bit hard to find but here they mention it:
https://helpx.adobe.com/experience-manager/kb/SetUpTheAdobeMavenRepository.html
Using that repo we can change the dependencies to this:
repositories {
// other repos
maven {
url 'https://repo.adobe.com/nexus/content/repositories/releases/'
}
}
回答3:
in my case i changed
classpath 'com.android.tools.build:gradle:3.3.2'
to
classpath 'com.android.tools.build:gradle:3.3.1'
and it work
来源:https://stackoverflow.com/questions/32550562/how-to-import-adobe-creative-sdk-in-android-studio