簡體   English   中英

NoClassDefFoundError:使用AWS Amplify將Google登錄添加到Android

[英]NoClassDefFoundError: Adding Google Sign In to Android using AWS Amplify

我正在遵循將google登錄信息添加到我的android應用程序的指南: https : //aws-amplify.github.io/docs/android/authentication#google-login-in-your-mobile-app

我收到此錯誤:

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看起來和他們提供的完全一樣(需要導入)。 我猜想這與app / 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.+'

希望能幫助到你!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM