AWS认知库和Android支持

时间:2017-09-02 19:51:11

标签: android amazon-web-services gradle android-gradle

我一直在努力争取一个将使用以下内容构建的gradle文件:

compile('com.amazonaws:aws-android-sdk-auth-userpools:2.6.0@aar') { transitive = true; }
compile('com.amazonaws:aws-android-sdk-auth-ui:2.6.0@aar') { transitive = true; }
compile 'com.android.support:design:<absolutely any version>'

无论我使用什么版本,我都无法很好地完成这三件事。前两个是直接从amazons教程中获取的,用于集成用户登录(http://docs.aws.amazon.com/mobile-hub/latest/developerguide/add-aws-mobile-user-sign-in-email-and-password.html)。最后我用于应用程序的其余部分(看起来像一个非常标准的,期望的库用???编译。)

我为com.android.support:design尝试了以下版本: 24.2.0:导致错误:

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 24.2.0, 23.0.0

23.0.0也导致上述错误。

注意: 注释掉userpools库允许v23.0.0工作。注释掉auth-ui库允许v24.2.0工作......

1 个答案:

答案 0 :(得分:0)

排除属于依赖项的Android支持库。

例如,如果您的compileSdkVersion和targetSdkVersion为24,那么您将需要24. +支持库

在build.gradle中,在依赖项下执行以下更改:

.......
compile 'com.android.support:appcompat-v7:24.+'
compile 'com.android.support:support-v4:24.+'
compile 'com.android.support:design:24.+'
.......

compile('com.amazonaws:aws-android-sdk-auth-ui:2.6.0@aar') {
    transitive = true;
    exclude group: 'com.android.support', module: 'support-v4'
    exclude group: 'com.android.support', module: 'appcompat-v7'
    exclude group: 'com.android.support', module: 'cardview-v7'
}
compile('com.amazonaws:aws-android-sdk-auth-userpools:2.6.0@aar') {
    transitive = true;
    exclude group: 'com.android.support', module: 'support-v4'
}