0

我正在使用 Aws Mobile Hub 构建一个提供 facebook 和 Googlelogin 按钮的 android 应用程序。我使用 Aws 移动集线器添加了这些功能并下载了一个示例应用程序。当我运行该应用程序时,我收到了下面提到的错误。

E/SignInView: Couldn't construct the object. Class com.amazonaws.mobile.auth.facebook.FacebookButton is not found. Please import the appropriate dependencies: com.amazonaws.mobile.auth.facebook.FacebookButton
                                                             java.lang.NoSuchMethodException: <init> [class android.content.Context]
                                                                 at java.lang.Class.getConstructor0(Class.java:2204)
                                                                 at java.lang.Class.getConstructor(Class.java:1683)
                                                                 at com.amazonaws.mobile.auth.ui.SignInView.createDependencyObject(SignInView.java:420)
                                                                 at com.amazonaws.mobile.auth.ui.SignInView.addSignInButtonsToView(SignInView.java:502)
                                                                 at com.amazonaws.mobile.auth.ui.SignInView.setUpSignInButtons(SignInView.java:282)
                                                                 at com.amazonaws.mobile.auth.ui.SignInView.<init>(SignInView.java:317)
                                                                 at com.amazonaws.mobile.auth.ui.SignInView.<init>(SignInView.java:159)
                                                                 at java.lang.reflect.Constructor.newInstance0(Native Method)
                                                                 at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
                                                                 at android.view.LayoutInflater.createView(LayoutInflater.java:652)
                                                                 at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:794)
                                                                 at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734)
                                                                 at android.view.LayoutInflater.inflate(LayoutInflater.java:496)
                                                                 at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
                                                                 at android.view.LayoutInflater.inflate(LayoutInflater.java:378)
                                                                 at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
                                                                 at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
                                                                 at com.amazonaws.mobile.auth.ui.SignInActivity.onCreate(SignInActivity.java:113)
                                                                 at android.app.Activity.performCreate(Activity.java:6955)
                                                                 at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126)
                                                                 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2927)
                                                                 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3045)
                                                                 at android.app.ActivityThread.-wrap14(ActivityThread.java)
                                                                 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1642)
                                                                 at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                 at android.os.Looper.loop(Looper.java:154)
                                                                 at android.app.ActivityThread.main(ActivityThread.java:6776)
                                                                 at java.lang.reflect.Method.invoke(Native Method)
                                                                 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
                                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
E/SignInView: Cannot construct an object of SignInButton com.amazonaws.mobile.auth.facebook.FacebookButton


E/SignInView: Couldn't construct the object. Class com.amazonaws.mobile.auth.google.GoogleButton is not found. Please import the appropriate dependencies: com.amazonaws.mobile.auth.google.GoogleButton
                                                             java.lang.NoSuchMethodException: <init> [class android.content.Context]
                                                                 at java.lang.Class.getConstructor0(Class.java:2204)
                                                                 at java.lang.Class.getConstructor(Class.java:1683)
                                                                 at com.amazonaws.mobile.auth.ui.SignInView.createDependencyObject(SignInView.java:420)
                                                                 at com.amazonaws.mobile.auth.ui.SignInView.addSignInButtonsToView(SignInView.java:502)
                                                                 at com.amazonaws.mobile.auth.ui.SignInView.setUpSignInButtons(SignInView.java:282)
                                                                 at com.amazonaws.mobile.auth.ui.SignInView.<init>(SignInView.java:317)
                                                                 at com.amazonaws.mobile.auth.ui.SignInView.<init>(SignInView.java:159)
                                                                 at java.lang.reflect.Constructor.newInstance0(Native Method)
                                                                 at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
                                                                 at android.view.LayoutInflater.createView(LayoutInflater.java:652)
                                                                 at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:794)
                                                                 at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734)
                                                                 at android.view.LayoutInflater.inflate(LayoutInflater.java:496)
                                                                 at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
                                                                 at android.view.LayoutInflater.inflate(LayoutInflater.java:378)
                                                                 at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
                                                                 at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
                                                                 at com.amazonaws.mobile.auth.ui.SignInActivity.onCreate(SignInActivity.java:113)
                                                                 at android.app.Activity.performCreate(Activity.java:6955)
                                                                 at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126)
                                                                 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2927)
                                                                 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3045)
                                                                 at android.app.ActivityThread.-wrap14(ActivityThread.java)
                                                                 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1642)
                                                                 at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                 at android.os.Looper.loop(Looper.java:154)
                                                                 at android.app.ActivityThread.main(ActivityThread.java:6776)
                                                                 at java.lang.reflect.Method.invoke(Native Method)
                                                                 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
                                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
E/SignInView: Cannot construct an object of SignInButton com.amazonaws.mobile.auth.google.GoogleButton

我已经完美地添加了所有依赖项。下面是 build.gradle 文件

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile fileTree(include: ['*.jar'], dir: 'app/libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    //Ormlite
    compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true;
    }
    //compile files('libs/YouTubeAndroidPlayerApi.jar')
    //compile 'com.github.nisrulz:screenshott:2.0.0'
    compile 'com.android.support:appcompat-v7:26.1.0'
    compile 'com.android.support:recyclerview-v7:26.1.0'
    compile 'com.android.support:cardview-v7:26.1.0'
    compile 'com.android.support:design:26.1.0'
    compile 'com.android.support:support-v4:26.1.0'
    compile 'com.android.support:mediarouter-v7:26.1.0'
    compile 'com.android.support:animated-vector-drawable:26.1.0'
    //compile 'com.android.support:percent:26.1.0'
    compile 'com.android.support:customtabs:26.1.0'
    compile 'com.android.support:preference-v7:26.1.0'
    compile 'com.android.support:preference-v14:26.1.0'
    compile 'com.google.firebase:firebase-messaging:11.6.2'
    compile 'com.google.firebase:firebase-core:11.6.2'
    compile 'com.google.firebase:firebase-database:11.6.2'
    compile 'com.google.firebase:firebase-auth:11.6.2'
    compile 'com.google.firebase:firebase-config:11.6.2'
    compile 'com.google.firebase:firebase-ads:11.6.2'
    compile 'com.facebook.android:facebook-android-sdk:4.25.0'
    compile 'com.facebook.android:audience-network-sdk:4.25.0'
    compile 'com.google.android.gms:play-services-auth:11.6.2'
    //compile 'com.google.android.gms:play-services-awareness:11.6.2'
    compile 'com.android.support:multidex:1.0.2'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.google.code.gson:gson:2.8.0'
    compile 'com.blankj:utilcode:1.5.1'
    compile 'com.j256.ormlite:ormlite-android:5.0'
    compile 'com.j256.ormlite:ormlite-core:5.0'
    compile 'com.airbnb.android:lottie:2.2.5'
    compile 'com.github.lsjwzh.RecyclerViewPager:lib:v1.1.2@aar'
    //compile 'com.github.lsjwzh.RecyclerViewPager:tablayoutsupport:v1.1.2@aar'
    compile 'com.evernote:android-job:1.2.1'
    compile 'com.makeramen:roundedimageview:2.2.1'
    annotationProcessor 'com.jakewharton:butterknife:8.8.1'
    compile 'com.jakewharton:butterknife:8.8.1'
    compile 'com.mindorks:placeholderview:0.7.2'
    compile 'jp.wasabeef:glide-transformations:2.0.2'
    /*compile 'com.specyci:residemenu:1.6+'*/
    //compile 'me.biubiubiu.justifytext:library:1.1'
    compile 'com.haozhang.libary:android-slanted-textview:1.2'
    //compile 'com.southernbox:RippleLayout:0.1.0'

    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile 'com.squareup.retrofit2:converter-gson:2.3.0'
    compile 'com.squareup.okhttp3:okhttp:3.8.1'
    //compile 'com.fivehundredpx:blurringview:1.0.0'

    compile 'pub.devrel:easypermissions:1.0.1'
    compile 'com.github.jd-alexander:LikeButton:0.2.3'

    testCompile 'junit:junit:4.12'
    compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation project(':nineoldandroids-library-2.4.0')

    //Cognito Related dependencies
    compile 'com.amazonaws:aws-android-sdk-core:2.6.+'
    compile 'com.amazonaws:aws-android-sdk-pinpoint:2.6.+'
    compile('com.amazonaws:aws-android-sdk-mobile-client:2.6.+@aar')
            { transitive = true; }

    compile('com.amazonaws:aws-android-sdk-auth-core:2.6.+@aar') {
        transitive = true;
    }
    compile('com.amazonaws:aws-android-sdk-auth-ui:2.6.+@aar') {
        transitive = true;
    }
    compile('com.amazonaws:aws-android-sdk-auth-facebook:2.6.+@aar') {
        transitive = true;
    }
    compile('com.amazonaws:aws-android-sdk-auth-google:2.6.+@aar') {
        transitive = true;
    }

我什至检查了 AWS 的 github 存储库的 issue 部分,但找不到任何东西。我也用谷歌搜索了这个问题,但没有运气。你能帮我解决这个问题吗?

4

0 回答 0