NoClassDefFoundError:使用AWS Amplify将谷歌登录添加到Android



我遵循将谷歌登录添加到我的android应用程序的指南:https://aws-amplify.github.io/docs/android/authentication#google-登录您的移动应用

我得到了这个错误:

E/AndroidRuntime: FATAL EXCEPTION: Thread-4
Process: com.xxxx.xxxx, PID: 16057
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/amazonaws/mobile/auth/userpools/CognitoUserPoolsSignInProvider;

(注意错误消息要长得多(

我的AuthenticatorActivity看起来和他们提供的完全一样(需要导入(。我猜这与应用程序/build.gradle:有关

apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.xxxx.xxxx"
minSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
// Mobile Client for initializing the SDK
implementation('com.amazonaws:aws-android-sdk-mobile-client:2.8.+@aar') { transitive = true }
// Google SignIn
implementation 'com.android.support:support-v4:28.+'
implementation('com.amazonaws:aws-android-sdk-auth-google:2.8.+@aar') { transitive = true }
// Sign in UI Library
implementation 'com.android.support:appcompat-v7:28.+'
implementation('com.amazonaws:aws-android-sdk-auth-ui:2.8.+@aar') { transitive = true }
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation fileTree(dir: 'libs', include: ['*.jar'])
//    implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

但我不确定是什么。我导入移动客户端的方式有问题吗?这是他们说应该做的事情。

您应该将以下内容添加到应用程序build.gradle文件的依赖项部分:

implementation 'com.amazonaws:aws-android-sdk-auth-userpools:2.8.+'

希望它能有所帮助!

最新更新