【问题标题】:Firebase Auth "Google Play Store is missing" issueFirebase 身份验证“缺少 Google Play 商店”问题
【发布时间】:2017-03-15 15:20:27
【问题描述】:

我尝试将我的应用程序与 firebase 连接,但我不能 我正在使用 Android Studio 2.2.3

我已经添加了依赖项 构建 gradle(项目)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath 'com.google.gms:google-services:3.0.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

并构建 gradle(应用程序)

apply plugin: 'com.android.application'
android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "dev.fbase.com.firebaseexample"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.0.1'
    testCompile 'junit:junit:4.12'
    compile 'com.google.firebase:firebase-auth:10.0.0'
}
apply plugin: 'com.google.gms.google-services'

我的代码是

public class MainActivity extends AppCompatActivity implements View.OnClickListener{
    private EditText editTextEmail,editTextPassword;
    private Button btnRegister;
    private ProgressDialog progressDialog;
    private FirebaseAuth firebaseAuth;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        progressDialog = new ProgressDialog(this);
        editTextEmail = (EditText)findViewById(R.id.editTextEmail);
        editTextPassword = (EditText)findViewById(R.id.editTextPassword);
        btnRegister = (Button) findViewById(R.id.btnRegister);
        firebaseAuth = FirebaseAuth.getInstance();

        btnRegister.setOnClickListener(this);


    }
    public void register(){
        String email = editTextEmail.getText().toString().trim();
        String password = editTextPassword.getText().toString().trim();
        Toast.makeText(this, ""+email+password, Toast.LENGTH_SHORT).show();

        if (TextUtils.isEmpty(email)||TextUtils.isEmpty(password))
        {
            Toast.makeText(MainActivity.this,"fill all the fields",Toast.LENGTH_SHORT).show();
            return;
        }
        progressDialog.setMessage("Registering..");
        progressDialog.show();
        firebaseAuth.createUserWithEmailAndPassword(email,password)
                .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                    @Override
                    public void onComplete(@NonNull Task<AuthResult> task) {
                        Toast.makeText(MainActivity.this, "success", Toast.LENGTH_SHORT).show();

                        if(task.isSuccessful())
                        {
                            progressDialog.dismiss();

                            Toast.makeText(MainActivity.this,"Registration Success",Toast.LENGTH_SHORT).show();
                        }
                        else
                        {
                            Toast.makeText(MainActivity.this,"Registration Failed",Toast.LENGTH_SHORT).show();
                        }
                    }
                });
    }
    @Override
    public void onClick(View v) {
        if(v==btnRegister)
        {
            register();
        }

    }
}

xml 布局具有 两个文本字段(EditTexts)和 一键式 我从教程视频中得到了这段代码 他们成功执行了此操作,但我尝试过显示异常

03-14 13:31:31.585 1054-1772/system_process V/WindowManager: 添加 窗口 Window{f249820 u0 PopupWindow:5e4fee9} 在 3 of 8(之后 窗口{d1abaee u0 dev.fbase.com.firebaseexample/dev.fbase.com.firebaseexample.MainActivity}) 03-14 13:31:31.642 2331-2632/dev.fbase.com.firebaseexample W/EGL_emulation:eglSurfaceAttrib 未实现 03-14 13:31:31.642 2331-2632/dev.fbase.com.firebaseexample W/OpenGLRenderer:未能 在表面 0xe242b580 上设置 EGL_SWAP_BEHAVIOR,错误=EGL_SUCCESS 03-14 13:32:00.808 1054-1225/system_process W/AudioTrack: AUDIO_OUTPUT_FLAG_FAST 被客户端拒绝 03-14 13:32:00.846 1054-1502/system_process V/WindowManager:不是基础应用程序:添加窗口 窗口{4bd695 u0 dev.fbase.com.firebaseexample/dev.fbase.com.firebaseexample.MainActivity} 在 3 of 8 03-14 13:32:00.852 2331-2619/dev.fbase.com.firebaseexample W/DynamiteModule:本地模块描述符类 com.google.firebase.auth 未找到。 03-14 13:32:00.852 2331-2619/dev.fbase.com.firebaseexample W/GooglePlayServicesUtil: Google Play 商店不见了。 03-14 13:32:00.911 2331-2632/dev.fbase.com.firebaseexample W/EGL_emulation: eglSurfaceAttrib 未实施 03-14 13:32:00.912 2331-2632/dev.fbase.com.firebaseexample W/OpenGLRenderer:未能 在表面 0xe242b720 上设置 EGL_SWAP_BEHAVIOR,错误 = EGL_SUCCESS 03-14 13:32:01.335 2331-2632/dev.fbase.com.firebaseexample W/EGL_emulation: eglSurfaceAttrib 未实施 03-14 13:32:01.335 2331-2632/dev.fbase.com.firebaseexample W/OpenGLRenderer:未能 在表面 0xe247da20 上设置 EGL_SWAP_BEHAVIOR,错误 = EGL_SUCCESS 03-14 13:32:01.721 2331-2632/dev.fbase.com.firebaseexample V/RenderScript: 0xeed9da00 启动线程,CPU 4

【问题讨论】:

  • 请问问题是否已解决?

标签: android firebase firebase-authentication


【解决方案1】:

堆栈跟踪表明设备中缺少 Google Play 商店。要使 firebase 正常工作,您需要一台具有 Google Play Services 10 或更高版本的设备。 (来自https://firebase.google.com/docs/android/setup)。如果它是模拟器,请确保创建包含 Google API 的模拟器。

【讨论】:

    猜你喜欢
    • 2017-03-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-16
    • 1970-01-01
    • 2021-03-22
    相关资源
    最近更新 更多