Dependency is ignored for debug after adding AWS - android

On adding
compile 'com.amazonaws:aws-android-sdk-core:2.2.0'
compile 'com.amazonaws:aws-android-sdk-s3:2.2.0'
to my build.gradle, I get the error Warning:WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
Per Android dependency is ignored for release and Dependency commons-logging:commons-logging:1.2 is ignored for debug as it may be conflicting with the internal version provided by Android and a few others, I have added
compile 'com.amazonaws:aws-android-sdk-core:2.2.0' { exclude group: 'commons-logging', module: 'commons-logging' }
compile 'com.amazonaws:aws-android-sdk-s3:2.2.0' { exclude group: 'commons-logging', module: 'commons-logging' }
but now I am getting the error
Error:(34, 0) Could not find method com.amazonaws:aws-android-sdk-core:2.2.0() for arguments [build_4hd82gce5nfvqpzrlv6x687px$_run_closure2$_closure7#38039d7e] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Open File
I have not been able to find any suggestions as to what to do about this.
It might also be worth noting that I am still setting up the UI; other than this, I don't think I have actually added any code beyond what Android Studio auto generates.

Use this way
compile 'com.amazonaws:aws-android-sdk-s3:2.2.+'

Related

Warning after including Smack library: "Dependency xpp3:xpp3:1.1.4c is ignored for debug as it may be conflicting..."

After adding the smack library for android i have two warnings in android console of the smack
Warning:WARNING: Dependency xpp3:xpp3:1.1.4c is ignored for debug as
it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency xpp3:xpp3:1.1.4c is ignored for release as
it may be conflicting with the internal version provided by Android.
So, can any one explain to me that how can i get rid of the warning i am getting in the android console.
Android plugin already include the Xml Pull Parser 3rd Edition (XPP3), you need to remove the XPP3 from smack with something like this:
// need to add the exclude for every smack dependencies.
compile ("org.igniterealtime.smack:smack-android:4.1.0") {
exclude group: 'xpp3', module: 'xpp3'
}
or if you a bit lazy, you can use the following (though I'm not recommend a laziness) to remove XPP3 from all dependencies:
configurations {
all*.exclude group: 'xpp3', module: 'xpp3'
}

Conflict with dependency findbugs when importing Google Cloud PubSub in Android gradle

I have a bare empty Android project, I am following this guide for PubSub java client.
So basically I am only adding:
compile group: 'com.google.cloud', name: 'google-cloud-pubsub', version: '0.11.0-alpha'
to my gradle (the complete file is here)
The error I get is:
Error:Conflict with dependency 'com.google.code.findbugs:jsr305' in project ':app'. Resolved versions for app (3.0.0) and test app (2.0.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
There are also 2 warnings:
Warning:WARNING: Dependency org.json:json:20151123 is ignored for release as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for release as it may be conflicting with the internal version provided by Android.
I think this is related to #1319 but I can't make those suggested solutions work out.
Any suggestions?
It seems that excluding those replicated dependencies may fix it:
so, instead of
compile group: 'com.google.cloud', name: 'google-cloud-pubsub', version: '0.11.0-alpha'
this would produce no errors nor warnings:
compile ('com.google.cloud:google-cloud-pubsub:0.11.0-alpha') {
exclude group: 'com.google.code.findbugs'
exclude group: 'org.apache.httpcomponents'
exclude group: 'org.json'
}

Exclude package/classes from #aar, gradle dependency

I've following dependency added in build.gradle file.
compile 'com.aerisweather:aeris-maps-lib:2.0.0#aar'
It is from
https://oss.sonatype.org/content/repositories/comaerisweather-1027/com/aerisweather/aeris-maps-lib/2.0.0/
If you the see artifacts from following URL, It has android support v7 library classes.
https://oss.sonatype.org/#nexus-search;quick~aerisweather
I want to exclude that package when running/packaging the application. I'm unable to run/package the app due to duplicate class error.
I've tried adding configurations like this,
configurations {
all*.exclude group: 'com.android.support', module: 'appcompat-v7'
}
But this excludes it from entire project which leads me to many errors.
I've tried everything but still getting following error.
Error:Execution failed for task ':transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v7/appcompat/R$anim.class
This library has also as dependency support-v4 and mediarouter-v7.
You need to exclude them all from aeris-maps-lib and include as your own dependency.
def supportLibraryVersion = '25.0.1'
dependencies {
compile "com.android.support:support-v4:${supportLibraryVersion}"
compile "com.android.support:support-annotations:${supportLibraryVersion}"
compile "com.android.support:appcompat-v7:${supportLibraryVersion}"
//... other deps
compile ('com.aerisweather:aeris-maps-lib:2.0.0#aar', {
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'com.android.support', module: 'mediarouter-v7'
})
}
PS.
aeris-maps-lib has also com.google.android.gms:play-services dependency, which is the whole Play Services package (it's large) and you will need to enable MultiDex or shrink code with proguard.
not a direct answer, but an advice.
The exclusion feature provided by gradle (exclude method invocation) doesn't work for contents inside local aar files as those contents aren't defined by dependency management and hence aren't recognised by the same.
As far as the dependency resolution is concerned, the aar file is an individual unit (including all the resources/classes within). So the file needs to be built in a way which doesn't include those entries; Or if the file is not built by you, you can unpack and omit the files in question and repack.
While there may be hackish ways to drop certain files using gradle (I couldn't find any reliable one yet), where we could possibly hook into some intermediate build steps and get rid of the files; but the generally advised best practise is to avoid packaging publicly available dependencies into the aar/jar to avoid duplicate entry issues and keep the aar/jar size smaller.

Error when adding RxPresso to project

I got this error message when trying to add RxPresso(https://github.com/novoda/rxpresso/) to my project:
Warning:Conflict with dependency 'io.reactivex:rxjava'. Resolved versions for app (1.1.9) and test app (1.0.14) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
I'm currently using rxjava 1.1.9. How can I add RxPresso in my project?
Thx a lot
To avoid any problems with RxJava and Android Support Libraries version, go to your app/build.gradle file and in dependencies section paste:
androidTestCompile ('com.novoda:rxpresso:0.2.0') {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'io.reactivex'
}
You can explicitly tell Gradle which version to use, by adding into your build.gradle next snippet
configurations.all {
// check dependency tree with gradlew :app:dependencies
// avoid wildcard '+' dependencies used at 3rd libraries forcing them to exact version
resolutionStrategy.force "io.reactivex:rxjava:1.1.9"
}

How to exclude module from all dependencies but leave explicit declaration Gradle

I am trying to solve the problem,
I have some dependencies declared in build.gradle file for my android app, but the problem is that a lot of these dependencies use the same compat library, in my case appcompat-v7.
It is possible to exclude this library for each dependency
compile ('com.github......'){
exclude group: 'com.android.support', module: 'appcompat-v7'
}
But I need to do this in for each dependency
Another way is to use such expression
configurations {
compile.exclude module: 'appcompat-v7'
}
This works, but even If declare this library explicitly it is ignored compile 'com.android.support:appcompat-v7:+'
All what I need it is to include this library only once for the whole app, because if compile without exclude it will show a lot of errors like has been already defined.
Maybe there is an easier way to get this working. I would be grateful for any help, thanks.
We use a provided configuration in gradle (so that when we gradle:eclipse, the packages are included, but are not included when compiled into a jar, as these jars are expected to be provided at runtime). This configuration looks like the following:
configurations {
provided {
dependencies.all {dep ->
configurations.default.exclude group: dep.group, module:dep.name
}
}
compile.extendsFrom provided
}
This allows us to include dependencies as follows:
dependencies {
compile("org.scala-lang:scala-library:2.11.7")
compile("org.scala-lang:scala-compiler:2.11.7")
provided("org.apache.spark:spark-core_2_11:2.0.0")
}
Try creating a configuration which contains all dependencies where you want to exclude appcompat-v7, and then extend compile from this new configuration.

Categories

Resources