Facebook登录名仅可通过API 24使用-找不到com.google.firebase.auth的本地模块描述符类.错误 [英] Facebook Login works only from API 24 - Local module descriptor class for com.google.firebase.auth not found. error

查看:57
本文介绍了Facebook登录名仅可通过API 24使用-找不到com.google.firebase.auth的本地模块描述符类.错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在应用程序上添加了带有Firebase身份验证的facebook登录名,但登录身份验证仅可从Android API 24开始使用.

I added facebook login with firebase authentication on my application, but the login authentication works only from the Android API 24.

当我尝试使用较低级别的API时,屏幕冻结并且该应用程序停止运行.

When I try to use a lower level API the screen freezes and the application stops working.

它太高,大多数用户的

It is too high, most of the users have a lower API level.

实际上,我打算发布该应用程序以降低API级别.

Indeed I intend to release the application for lower API levels.

我正在使用的代码如下.

The code I am using is bellow.

public class ConfigurationActivity extends Activity {

    Button b_v_mm,b_som;
    LoginButton loginButton;
    CallbackManager callbackManager;

    // [START declare_auth]
    private FirebaseAuth mAuth;
    // [END declare_auth]


    private void handleFacebookAccessToken(AccessToken token) {
        Log.d("FireBase", "handleFacebookAccessToken:" + token);

        AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
        mAuth.signInWithCredential(credential)
                .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                    @Override
                    public void onComplete(@NonNull Task<AuthResult> task) {
                        if (task.isSuccessful()) {
                            // Sign in success, update UI with the signed-in user's information
                            Log.d("FireBase", "signInWithCredential:success");
                            FirebaseUser user = mAuth.getCurrentUser();
                            //updateUI(user);
                        } else {
                            // If sign in fails, display a message to the user.
                            Log.w("FireBase", "signInWithCredential:failure", task.getException());
                            //Toast.makeText(FacebookLoginActivity.this, "Authentication failed.",
                             //       Toast.LENGTH_SHORT).show();
                            //updateUI(null);
                        }

                        // ...
                    }
                });
    }

    // [START on_start_check_user]
    @Override
    public void onStart() {
        super.onStart();
        Log.d("FireBase", "onStart");
        // Check if user is signed in (non-null) and update UI accordingly.
        FirebaseUser currentUser = mAuth.getCurrentUser();
        //updateUI(currentUser);
    }
    // [END on_start_check_user]

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        Log.d("LoginFace", "LoginFace - onActivityResult");
        super.onActivityResult(requestCode, resultCode, data);
        Log.d("LoginFace", "LoginFace - onActivityResult");
        callbackManager.onActivityResult(requestCode, resultCode, data);
        Log.d("LoginFace", "LoginFace - After callbackManager");
/*
        if (AccessToken.getCurrentAccessToken() != null) {
            Log.d("AjudaFace", "AjudaFace - logout");
            LoginManager.getInstance().logOut();
        }*/
    }

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_configuration);

        //Botãp da barra de ferramentas que faz retornar para o Menu principal.
        b_v_mm = (Button) findViewById(com.cerveja.qof.pedro.qof_cerveja.R.id.b_v_mm);
        b_v_mm.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(ConfigurationActivity.this, MainMenu.class);
                startActivity(intent);
                finish();
            }
        });

        b_som = (Button) findViewById(com.cerveja.qof.pedro.qof_cerveja.R.id.b_som);
        //Altera opções de som.
        b_som.setOnClickListener(new View.OnClickListener() {
                                      @Override
                                      public void onClick(View v) {

                                          //Carrega opções de texto do botão, armazenadas no repositório de strings
                                          String s_som_on = getString(R.string.b_som_on);
                                          String s_som_off = getString(R.string.b_som_off);

                                          //Caso o som esteja desligado, o desliga.
                                          if(b_som.getText().equals(s_som_on)) {
                                              b_som.setText(s_som_off);
                                          }
                                          else //Caso o som esteja desligado, o liga.
                                              if (b_som.getText().equals(s_som_off)){
                                                  b_som.setText(s_som_on);
                                              }
                                      }
                                  }
        );

        callbackManager = CallbackManager.Factory.create();


// ...
// Initialize Firebase Auth
        mAuth = FirebaseAuth.getInstance();

        loginButton = (LoginButton) findViewById(R.id.login_button);
        loginButton.setReadPermissions("email","public_profile");
        Log.d("LoginFace", "LoginFace - Button Created");


        // Callback registration
        loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
            @Override
            public void onSuccess(LoginResult loginResult) {
                handleFacebookAccessToken(loginResult.getAccessToken());
                Log.d("LoginFace", "LoginFace - Sucesso");
                Toast.makeText(getApplicationContext(),
                        "LOGIN REALIZADO", Toast.LENGTH_LONG).show();
            }

            @Override
            public void onCancel() {
                Log.d("LoginFace", "LoginFace - Cancelado");
                Toast.makeText(getApplicationContext(),
                        "LOGIN CANCELADO", Toast.LENGTH_LONG).show();
            }


            @Override
            public void onError(FacebookException exception) {
                Log.d("LoginFace", "LoginFace - Erro");
                Toast.makeText(getApplicationContext(),
                        "LOGIN Erro", Toast.LENGTH_LONG).show();
                Log.d("LoginFace", exception.toString());
            }
        });


    }
}

MyApplication活动中使用的对象

Objects used in MyApplication activity

import android.app.Application;
import android.content.Context;

**上面列出了项目中使用的所有对象

**All objects used in the project are listed above

API 23日志:

12-02 17:22:26.900 2668-2745/? D/EGL_emulation:eglMakeCurrent: 0xaa9ba4e0:版本2 0(tinfo 0xac3853a0)

12-02 17:22:26.900 2668-2745/? D/EGL_emulation: eglMakeCurrent: 0xaa9ba4e0: ver 2 0 (tinfo 0xac3853a0)

                                            [ 12-02 17:22:26.949  2668: 3361 D/         ]
                                            HostConnection::get() New Host Connection established 0xa19c5800, tid 3361


                                            [ 12-02 17:22:26.950  2668: 3361 W/         ]
                                            Unrecognized GLES max version string in extensions: ANDROID_EMU_CHECKSUM_HELPER_v1

ANDROID_EMU_dma_v1 12-02 17:22:26.977 2668-3361/? D/EGL_emulation: eglCreateContext:0xaa9ba900:maj 2 min 0 rcv 2 12-02 17:22:26.978 2668-3361/? D/EGL_emulation:eglMakeCurrent:0xaa9ba900:ver 2 0 (tinfo 0xa23bf7e0)12-02 17:22:26.980 2668-3361/? E/eglCodecCommon: glUtilsParamSize:未知参数0x00008cdf 12-02 17:22:26.980 2668-3361/? E/eglCodecCommon:glUtilsParamSize:unknow参数 0x00008824 12-02 17:22:26.980 2668-3361/? E/eglCodecCommon: glUtilsParamSize:未知参数0x00008cdf 12-02 17:22:26.980 2668-3361/? E/eglCodecCommon:glUtilsParamSize:unknow参数 0x00008824 12-02 17:22:27.135 2668-3361/? D/EGL_emulation: eglCreateContext:0xaa9ba9c0:maj 2 min 0 rcv 2 12-02 17:22:27.136 2668-3361/? D/EGL_emulation:eglMakeCurrent:0xaa9ba9c0:ver 2 0 (tinfo 0xa23bf7e0)12-02 17:22:29.740 2668-2668/com.cerveja.qof.pedro.qof_cerveja W/BindingManager:无法 调用definedVisibility()-从未看到该pid的连接:2668 12-02 17:22:32.649 2668-2745/com.cerveja.qof.pedro.qof_cerveja D/EGL_emulation:eglMakeCurrent:0xaa9ba4e0:ver 2 0(tinfo 0xac3853a0)12-02 17:22:32.650 2668-2745/com.cerveja.qof.pedro.qof_cerveja E/曲面: getSlotFromBufferLocked:未知缓冲区:0xb40bdc00 12-02 17:22:32.676 2668-3361/com.cerveja.qof.pedro.qof_cerveja D/EGL_emulation: eglMakeCurrent:0xaa9ba900:ver 2 0(tinfo 0xa23bf7e0)12-02 17:22:32.687 2668-3361/com.cerveja.qof.pedro.qof_cerveja D/EGL_emulation:eglMakeCurrent:0xaa9ba9c0:ver 2 0(tinfo 0xa23bf7e0)12-02 17:22:32.704 2668-2745/com.cerveja.qof.pedro.qof_cerveja D/EGL_emulation: eglMakeCurrent:0xaa9ba4e0:ver 2 0(tinfo 0xac3853a0)12-02 17:22:32.716 2668-2745/com.cerveja.qof.pedro.qof_cerveja E/eglCodecCommon:glUtilsParamSize:unknow参数0x00008cdf 12-02 17:22:32.767 2668-3361/com.cerveja.qof.pedro.qof_cerveja D/EGL_emulation:eglMakeCurrent:0xaa9ba900:ver 2 0(tinfo 0xa23bf7e0)12-02 17:27:05.115 2668-2711/com.cerveja.qof.pedro.qof_cerveja W/DynamiteModule:本地 找不到com.google.firebase.auth的模块描述符类.

ANDROID_EMU_dma_v1 12-02 17:22:26.977 2668-3361/? D/EGL_emulation: eglCreateContext: 0xaa9ba900: maj 2 min 0 rcv 2 12-02 17:22:26.978 2668-3361/? D/EGL_emulation: eglMakeCurrent: 0xaa9ba900: ver 2 0 (tinfo 0xa23bf7e0) 12-02 17:22:26.980 2668-3361/? E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008cdf 12-02 17:22:26.980 2668-3361/? E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008824 12-02 17:22:26.980 2668-3361/? E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008cdf 12-02 17:22:26.980 2668-3361/? E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008824 12-02 17:22:27.135 2668-3361/? D/EGL_emulation: eglCreateContext: 0xaa9ba9c0: maj 2 min 0 rcv 2 12-02 17:22:27.136 2668-3361/? D/EGL_emulation: eglMakeCurrent: 0xaa9ba9c0: ver 2 0 (tinfo 0xa23bf7e0) 12-02 17:22:29.740 2668-2668/com.cerveja.qof.pedro.qof_cerveja W/BindingManager: Cannot call determinedVisibility() - never saw a connection for the pid: 2668 12-02 17:22:32.649 2668-2745/com.cerveja.qof.pedro.qof_cerveja D/EGL_emulation: eglMakeCurrent: 0xaa9ba4e0: ver 2 0 (tinfo 0xac3853a0) 12-02 17:22:32.650 2668-2745/com.cerveja.qof.pedro.qof_cerveja E/Surface: getSlotFromBufferLocked: unknown buffer: 0xb40bdc00 12-02 17:22:32.676 2668-3361/com.cerveja.qof.pedro.qof_cerveja D/EGL_emulation: eglMakeCurrent: 0xaa9ba900: ver 2 0 (tinfo 0xa23bf7e0) 12-02 17:22:32.687 2668-3361/com.cerveja.qof.pedro.qof_cerveja D/EGL_emulation: eglMakeCurrent: 0xaa9ba9c0: ver 2 0 (tinfo 0xa23bf7e0) 12-02 17:22:32.704 2668-2745/com.cerveja.qof.pedro.qof_cerveja D/EGL_emulation: eglMakeCurrent: 0xaa9ba4e0: ver 2 0 (tinfo 0xac3853a0) 12-02 17:22:32.716 2668-2745/com.cerveja.qof.pedro.qof_cerveja E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008cdf 12-02 17:22:32.767 2668-3361/com.cerveja.qof.pedro.qof_cerveja D/EGL_emulation: eglMakeCurrent: 0xaa9ba900: ver 2 0 (tinfo 0xa23bf7e0) 12-02 17:27:05.115 2668-2711/com.cerveja.qof.pedro.qof_cerveja W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.

最后一个可能是错误原因:

This final one is probably the error cause:

12-02 17:27:05.115 2668-2711/com.cerveja.qof.pedro.qof_cerveja W/DynamiteModule:找不到com.google.firebase.auth的本地模块描述符类.

12-02 17:27:05.115 2668-2711/com.cerveja.qof.pedro.qof_cerveja W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.

如何降低所需的API级别?

What can I do to lower the API level required?

推荐答案

尝试将客户端与Firebase应用重新同步,然后再次添加.json文件.

Try resync your client with your Firebase app, and add again the .json file.

在android studio 2.3中,只需点击tools> firebase,然后在助手中检查您的应用是否已连接.

In android studio 2.3 just click on tools>firebase and in the assistant check if your app is connected to.

并确保在Facebook开发人员帐户和Firebase控制台中软件包名称正确.

And also make sure that the package name is correct in both facebook developers account and firebase console.

使用最新的Firebase库

您可以检查您的Google Play服务版本吗?

Can you check your Google Play Services version?

Android设备应具有Google Play服务9.0.0或更高版本

The Android device should have Google Play services 9.0.0 or later

此问题的原因之一可能是,您在Firebase中的登录方法">身份验证仪表板"可能已禁用

One of the reason for this problem could be, your Sign In Method inside Firebase > Auth Dashboard might be disabled

这篇关于Facebook登录名仅可通过API 24使用-找不到com.google.firebase.auth的本地模块描述符类.错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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