마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

안드로이드 스튜디오 개발 하고 앱을 실행 하면 강제종료가 발생합니다.

0 추천
package com.hanseo_software.gpstrackerapp;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.SignInMethodQueryResult;

import java.util.List;

public class RegisterActivity extends AppCompatActivity {

    EditText e4_email;
    FirebaseAuth auth;
    ProgressDialog dialog;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);
        e4_email = (EditText)findViewById(R.id.editText4);
        auth = FirebaseAuth.getInstance();
        dialog = new ProgressDialog(this);

    }

//    public void goToPasswordActivtity(View v) {
//        Intent myIntent = new Intent(RegisterActivity.this, PasswordActivity.class);
//        startActivity(myIntent);
//    }

    public void goToPasswordActivtity(View v) {
        dialog.setMessage("checking email address");
        dialog.show();
         //이 이메일이 실제로 있는지 없는지 확인
        auth.fetchSignInMethodsForEmail(e4_email.getText().toString())
                .addOnCompleteListener(new OnCompleteListener<SignInMethodQueryResult>() {
                    @Override
                    public void onComplete(@NonNull Task<SignInMethodQueryResult> task) {
                        if (task.isSuccessful()) {
                            dialog.dismiss();
                            //boolean check = !task.getResult().getProviders().isEmpthy();
                            boolean check = !task.getResult().getSignInMethods().isEmpty();

                            if (!check) {
                            //if (task.getResult().getSignInMethods().size() == 0){
                                //email이 존재하지 않아서 생성할 수 있다.
                                Intent myIntent = new Intent(RegisterActivity.this, PasswordActivity.class);
                                myIntent.putExtra("eamil", e4_email.getText().toString());
                                startActivity(myIntent);
                                finish();

                            } else {
                                dialog.dismiss();
                                Toast.makeText(getApplicationContext(),"이 eamail은 이미 생성되어 있습니다.",Toast.LENGTH_LONG).show();
                            }
                        }
                    }
                });

    }
}

이메일을 입력하고 next를 누르면 강제종료가 발생합니다. 수정 전에는 다른 부분에서 강제종료가 발생했는데 수정 후에는 이 부분에서 강제 종료가 발생합니다.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.hanseo_software.gpstrackerapp">
    <!--
         The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
         Google Maps Android API v2, but you must specify either coarse or fine
         location permissions for the 'MyLocation' functionality.
    -->
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name=".UserLocationMainActivity"
            android:label="@string/title_activity_user_location_main"
            android:theme="@style/AppTheme.NoActionBar"></activity>
        <!--
             The API key for Google Maps-based APIs is defined as a string resource.
             (See the file "res/values/google_maps_api.xml").
             Note that the API key is linked to the encryption key used to sign the APK.
             You need a different API key for each encryption key, including the release key that is used to
             sign the APK for publishing.
             You can define the keys for the debug and release targets in src/debug/ and src/release/.
        -->
        <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="@string/google_maps_key" />

        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
            android:theme="@style/Base.Theme.AppCompat" />
        <activity android:name=".InviteCodeActivity" />
        <activity android:name=".NameActivity" />
        <activity android:name=".PasswordActivity" />
        <activity android:name=".RegisterActivity" />
        <activity android:name=".LoginActivity" />
    </application>

</manifest>
준톨이짱짱 (440 포인트) 님이 2020년 2월 16일 질문

답변 달기

· 글에 소스 코드 보기 좋게 넣는 법
· 질문에 대해 추가적인 질문이나 의견이 있으면 답변이 아니라 댓글로 달아주시기 바랍니다.
표시할 이름 (옵션):
개인정보: 당신의 이메일은 이 알림을 보내는데만 사용됩니다.
스팸 차단 검사:
스팸 검사를 다시 받지 않으려면 로그인하거나 혹은 가입 하세요.
...