与Android软件包冲突 - 亚马逊SNS [英] Conflict with android package - Amazon SNS

查看:136
本文介绍了与Android软件包冲突 - 亚马逊SNS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试将Amazon SNS客户端与Android项目集成。

I have been trying to integrate the Amazon SNS client with an android project.

我使用以下依赖命令包含库

I am including the library using the following dependency commands

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile 'com.amazonaws:aws-java-sdk-sns:1.10.+'
    compile 'com.google.android.gms:play-services:7.5.0'
}

因此它自动包含上面的库(及其依赖项:
aws_java_sdk_core aws_java_sdk_sqs )。所有3个库都有 1.10.2 版本。

Thus it automatically includes the above library (and its dependencies : aws_java_sdk_core and aws_java_sdk_sqs). All 3 libraries have a version 1.10.2.

问题是AWS核心有两个模块

The problem is that the AWS core has two modules


  1. commons-logging(commons-logging:commons-logging:1.1.3)

  2. httpclient(org.apache.httpcomponents:httpclient :4.3.6)

由于android内部具有相同的包,因此它排除了这些模块
以避免任何冲突。结果是当aws代码尝试从这些模块访问某些类时。 Tt期待它的不同版本,找不到预期的方法,并使应用程序崩溃。

As android has the same packages internally, it excludes these modules to avoid any conflict. The result is that when the aws code tries to access some classes from these modules. Tt is expecting a different version of it, does not find the expected method, and crashes the application.

有没有办法覆盖android的排除? (或者有更好的方法来处理这种情况吗?)

Is there any way to override android's exclude? (Or is there a better way to handle this situation?)

编辑:添加了gradle日志:

Added gradle log :

WARNING: Dependency commons-logging:commons-logging:1.1.3 is ignored for debug as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency org.apache.httpcomponents:httpclient:4.3.6 is ignored for debug as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency commons-logging:commons-logging:1.1.3 is ignored for release as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency org.apache.httpcomponents:httpclient:4.3.6 is ignored for release as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages


推荐答案

由于您正在开发Android项目,请考虑使用 AWS SDK for Android 。它针对Android平台进行了优化。它具有更小的库,更少的依赖性和其他优化。它应该解决冲突的问题。查看开发者指南

Since you are working on an Android project, please consider use AWS SDK for Android. It's optimized for Android platform. It has smaller libraries, fewer dependencies, and other optimizations. It should solve the conflicting problem. Check out the developer guide.

这就像更新依赖项以编译'com.amazonaws:aws-android-sdk-sns:2.2。+'一样简单。它的用法应该与Java SDK的用法兼容。

It's just as simple as updating the dependency to compile 'com.amazonaws:aws-android-sdk-sns:2.2.+'. It's usage should be compatible with that of Java SDK.

这篇关于与Android软件包冲突 - 亚马逊SNS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆