0 Replies - 845 Views - Last Post: 10 July 2019 - 03:09 AM

#1 shhr3y   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 05-July 19

Debugging Error - "Unfortunately, App Has Stopped"

Posted 10 July 2019 - 03:09 AM

I've be currently getting the same error every single time I debug my application in the emulator on Android Studio. The error is, "Unfortunately, app has stopped." I'm not sure what is wrong at all because I've searched it up to see if anything could help but didn't work.

If you could please take a minute to look through my code and logcat to see if you can find a solution for my error. Thank you so much.



This is my ProfileActivity
package com.shrey.ekka;

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

import android.os.Bundle;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;

public class ProfileActivity extends AppCompatActivity {
    private TextView profile_fname, profile_lname, profile_email, profile_phone;
    private Button edit_details;
    private FirebaseAuth Auth ;
    private FirebaseDatabase Database;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_profile);

        profile_fname = findViewById(R.id.user_fname);
        profile_lname = findViewById(R.id.user_lname);
        profile_email = findViewById(R.id.user_email);
        profile_phone = findViewById(R.id.user_phone_num);
        edit_details = findViewById(R.id.edit_details);

        Auth = FirebaseAuth.getInstance();
        Database = FirebaseDatabase.getInstance();

        DatabaseReference reference = Database.getReference(Auth.getUid());

        reference.addValueEventListener(new ValueEventListener() {
            @Override
            public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
                UserProfile profile = dataSnapshot.getValue(UserProfile.class);
                profile_fname.setText(profile.getUserfname());
                profile_lname.setText(profile.getUserlname());
                profile_email.setText(profile.getUseremail());
                profile_phone.setText(profile.getUserphone());
            }

            @Override
            public void onCancelled(@NonNull DatabaseError databaseError) {
                Toast.makeText(ProfileActivity.this, "Data could not be Retrieved" + databaseError.getDetails(), Toast.LENGTH_SHORT).show();
            }
        });
    }
}





This is my UserProfile

package com.shrey.ekka;

public class UserProfile {
    public String userfname,userlname,useremail,userphone;

    public UserProfile(){
    }

    public UserProfile(String userfname, String userlname, String useremail, String userphone) {
        this.userfname = userfname;
        this.userlname = userlname;
        this.useremail = useremail;
        this.userphone = userphone;
    }


    public String getUserfname() {
        return userfname;
    }

    public void setUserfname(String userfname) {
        this.userfname = userfname;
    }

    public String getUserlname() {
        return userlname;
    }

    public void setUserlname(String userlname) {
        this.userlname = userlname;
    }

    public String getUseremail() {
        return useremail;
    }

    public void setUseremail(String useremail) {
        this.useremail = useremail;
    }

    public String getUserphone() {
        return userphone;
    }

    public void setUserphone(String userphone) {
        this.userphone = userphone;
    }
}




This is my Start
package com.shrey.ekka;

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

import android.content.Intent;
import android.os.Bundle;

import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;

import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;

public class Start extends AppCompatActivity
{
private ImageButton customize,recommended,celebrities,previous;
private Button my_profile;
private TextView hey;
private FirebaseAuth Auth ;
private FirebaseDatabase Database;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_start);

        customize = findViewById(R.id.customize);
        customize.setonclickListener(new View.onclickListener() {
            @Override
            public void onclick(View view) {
                opentrim();
            }
        });
        recommended = findViewById(R.id.recom);
        recommended.setonclickListener(new View.onclickListener() {
            @Override
            public void onclick(View view) {
                openrecom();
            }
        });
        celebrities = findViewById(R.id.celeb);
        celebrities.setonclickListener(new View.onclickListener() {
            @Override
            public void onclick(View view) {
                openceleb();
            }
        });
        previous = findViewById(R.id.prev);
        previous.setonclickListener(new View.onclickListener() {
            @Override
            public void onclick(View view) {
                openprev();
            }
        });

        my_profile = findViewById(R.id.my_profile);
        my_profile.setonclickListener(new View.onclickListener() {
            @Override
            public void onclick(View view) {
                Intent my_profile = new Intent(Start.this, ProfileActivity.class);
                startActivity(my_profile);
            }
        });

        hey = findViewById(R.id.hey);
        Auth = FirebaseAuth.getInstance();
        Database = FirebaseDatabase.getInstance();

        DatabaseReference reference = Database.getReference(Auth.getUid());

        reference.addValueEventListener(new ValueEventListener() {
            @Override
            public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
                UserProfile profile = dataSnapshot.getValue(UserProfile.class);
                hey.setText(profile.getUserfname());
            }

            @Override
            public void onCancelled(@NonNull DatabaseError databaseError) {
                Toast.makeText(Start.this, "Data could not be Retrieved" + databaseError.getDetails(), Toast.LENGTH_SHORT).show();
            }
        });



    }
    public void opentrim(){
        Intent trim = new Intent(this, Customize.class);
        startActivity(trim);
    }
    public void openrecom(){
        Intent recommend = new Intent(this, Recommend.class);
        startActivity(recommend);
    }
    public void openceleb(){
        Intent celeb = new Intent(this, Celebrities.class);
        startActivity(celeb);
    }
    public void openprev(){
        Intent previous = new Intent(this, Previous.class);
        startActivity(previous);
    }


}




This is my Signup

package com.shrey.ekka;

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

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;

public class Signup extends AppCompatActivity
{
    private String fname, lname, user_pass, ruser_pass, email,phone;
    private TextView please_details;
    private EditText fname_input, lname_input, user_pass_input, ruser_pass_input, phone_input, email_input;
    private Button confirm,face_shape;
    private FirebaseAuth Auth;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_signup);


        please_details = findViewById(R.id.enter_details);
        fname_input = findViewById(R.id.firstname);
        lname_input = findViewById(R.id.lastname);
        email_input = findViewById(R.id.email);
        user_pass_input = findViewById(R.id.npassword);
        ruser_pass_input = findViewById(R.id.nrpassword);
        phone_input = findViewById(R.id.pnumber);

        Auth = FirebaseAuth.getInstance();

        confirm = findViewById(R.id.confirm);
        confirm.setonclickListener(new View.onclickListener() {
            @Override
            public void onclick(View view) {
                fname = fname_input.getText().toString().trim();
                lname = lname_input.getText().toString().trim();
                user_pass = user_pass_input.getText().toString().trim();
                ruser_pass = ruser_pass_input.getText().toString().trim();
                email = email_input.getText().toString().trim();
                phone = phone_input.getText().toString().trim();

                if (String.valueOf(user_pass).equals(String.valueOf(ruser_pass)))
                {
                    Authen();
                    sendData();
                }
                else {
                    Toast.makeText(Signup.this, "Password didn't Match",Toast.LENGTH_SHORT).show();
                }
            }
        });

        face_shape = findViewById(R.id.face_shape_button);
        face_shape.setonclickListener(new View.onclickListener() {
            @Override
            public void onclick(View view) {
                openFaceShape();
            }
        });
    }
    public void toast(String text){
        Toast.makeText(Signup.this, text, Toast.LENGTH_SHORT).show();
    }
    public void openLogin() {
        Intent login = new Intent(this, MainActivity.class);
        startActivity(login);
    }
    public void openFaceShape() {
    Intent faces = new Intent(this, FaceShape.class);
    startActivity(faces);
    }
    public void Authen() {

        Auth.createUserWithEmailAndPassword(email,user_pass).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
            @Override
            public void onComplete(@NonNull Task<AuthResult> task) {
                if (task.isSuccessful()) {
                    Toast.makeText(Signup.this, "Registration Complete", Toast.LENGTH_SHORT).show();
                    openLogin();
                } else {
                    Toast.makeText(Signup.this, "Registration Failed", Toast.LENGTH_SHORT).show();
                }
            }
        });
    }

    public void sendData() {
        FirebaseDatabase data = FirebaseDatabase.getInstance();
        DatabaseReference myRef = data.getReference(Auth.getUid());
        UserProfile profile = new UserProfile(fname,lname,email,phone);
        myRef.setValue(profile, new DatabaseReference.CompletionListener() {
            @Override
            public void onComplete(@Nullable DatabaseError databaseError, @NonNull DatabaseReference databaseReference) {
                if (databaseError != null) {
                    Toast.makeText(Signup.this, "Data could not be saved" + databaseError.getMessage(), Toast.LENGTH_SHORT).show();
                } else {
                    Toast.makeText(Signup.this, "Data saved successfully.", Toast.LENGTH_SHORT).show();
                }
            }
        });
    }
}






And this is my Logcat

07-10 15:14:04.395 8761-8761/? I/art: Not late-enabling -Xcheck:jni (already on)
07-10 15:14:04.455 8761-8761/com.shrey.ekka W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.shrey.ekka-2/split_lib_dependencies_apk.apk --oat-file=/data/dalvik-cache/x86/[email protected]@[email protected][email protected]) because non-0 exit status
07-10 15:14:04.605 8761-8761/com.shrey.ekka W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.shrey.ekka-2/split_lib_slice_0_apk.apk --oat-file=/data/dalvik-cache/x86/[email protected]@[email protected][email protected]) because non-0 exit status
07-10 15:14:04.614 8761-8761/com.shrey.ekka W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.shrey.ekka-2/split_lib_slice_1_apk.apk --oat-file=/data/dalvik-cache/x86/[email protected]@[email protected][email protected]) because non-0 exit status
07-10 15:14:04.631 8761-8761/com.shrey.ekka W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.shrey.ekka-2/split_lib_slice_2_apk.apk --oat-file=/data/dalvik-cache/x86/[email protected]@[email protected][email protected]) because non-0 exit status
07-10 15:14:04.644 8761-8761/com.shrey.ekka W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.shrey.ekka-2/split_lib_slice_3_apk.apk --oat-file=/data/dalvik-cache/x86/[email protected]@[email protected][email protected]) because non-0 exit status
07-10 15:14:04.656 8761-8761/com.shrey.ekka W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.shrey.ekka-2/split_lib_slice_4_apk.apk --oat-file=/data/dalvik-cache/x86/[email protected]@[email protected][email protected]) because non-0 exit status
07-10 15:14:04.666 8761-8761/com.shrey.ekka W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.shrey.ekka-2/split_lib_slice_5_apk.apk --oat-file=/data/dalvik-cache/x86/[email protected]@[email protected][email protected]) because non-0 exit status
07-10 15:14:04.675 8761-8761/com.shrey.ekka W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.shrey.ekka-2/split_lib_slice_6_apk.apk --oat-file=/data/dalvik-cache/x86/[email protected]@[email protected][email protected]) because non-0 exit status
07-10 15:14:04.686 8761-8761/com.shrey.ekka W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.shrey.ekka-2/split_lib_slice_7_apk.apk --oat-file=/data/dalvik-cache/x86/[email protected]@[email protected][email protected]) because non-0 exit status
07-10 15:14:04.696 8761-8761/com.shrey.ekka W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.shrey.ekka-2/split_lib_slice_8_apk.apk --oat-file=/data/dalvik-cache/x86/[email protected]@[email protected][email protected]) because non-0 exit status
07-10 15:14:04.708 8761-8761/com.shrey.ekka W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.shrey.ekka-2/split_lib_slice_9_apk.apk --oat-file=/data/dalvik-cache/x86/[email protected]@[email protected][email protected]) because non-0 exit status
07-10 15:14:04.709 8761-8761/com.shrey.ekka W/System: ClassLoader referenced unknown path: /data/app/com.shrey.ekka-2/lib/x86
07-10 15:14:04.821 8761-8761/com.shrey.ekka V/FA: Registered activity lifecycle callback
07-10 15:14:04.863 8761-8803/com.shrey.ekka W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
07-10 15:14:04.878 8761-8761/com.shrey.ekka D/FirebaseAuth: Notifying id token listeners about user ( X4Pu9oUOGgPLwsL5gapZWQqgze73 ).
07-10 15:14:04.887 8761-8761/com.shrey.ekka I/FirebaseInitProvider: FirebaseApp initialization successful
07-10 15:14:04.889 8761-8761/com.shrey.ekka I/InstantRun: starting instant run server: is main process
07-10 15:14:04.898 8761-8800/com.shrey.ekka V/FA: App package, google app id: com.shrey.ekka, 1:920547747763:android:e3d6e85881651b77
07-10 15:14:04.899 8761-8800/com.shrey.ekka I/FA: App measurement is starting up, version: 16250
07-10 15:14:04.899 8761-8800/com.shrey.ekka I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
07-10 15:14:04.899 8761-8800/com.shrey.ekka I/FA: To enable faster debug mode event logging run:
      adb shell setprop debug.firebase.analytics.app com.shrey.ekka
07-10 15:14:04.899 8761-8800/com.shrey.ekka D/FA: Debug-level message logging enabled
07-10 15:14:04.917 8761-8805/com.shrey.ekka W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
07-10 15:14:04.929 8761-8805/com.shrey.ekka I/FirebaseAuth: [FirebaseAuth:] Loading module via FirebaseOptions.
07-10 15:14:04.929 8761-8805/com.shrey.ekka I/FirebaseAuth: [FirebaseAuth:] Preparing to create service connection to gms implementation
07-10 15:14:04.943 8761-8800/com.shrey.ekka V/FA: Connection attempt already in progress
07-10 15:14:04.953 8761-8761/com.shrey.ekka W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter androidx.vectordrawable.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
07-10 15:14:04.972 8761-8761/com.shrey.ekka V/FA: onActivityCreated
07-10 15:14:04.992 8761-8761/com.shrey.ekka I/art: Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>
07-10 15:14:04.992 8761-8761/com.shrey.ekka I/art: Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>
07-10 15:14:05.060 8761-8800/com.shrey.ekka I/FA: Tag Manager is not found and thus will not be used
07-10 15:14:05.064 8761-8800/com.shrey.ekka D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_screen_class(_sc)=MainActivity, firebase_screen_id(_si)=-3829671836164239926}]
07-10 15:14:05.073 8761-8809/com.shrey.ekka D/OpenGLRenderer: Use EGL_SWAP_behavior_PRESERVED: true
07-10 15:14:05.087 8761-8800/com.shrey.ekka V/FA: Connection attempt already in progress
07-10 15:14:05.088 8761-8800/com.shrey.ekka V/FA: Connection attempt already in progress
07-10 15:14:05.089 8761-8800/com.shrey.ekka V/FA: Activity resumed, time: 13321617
07-10 15:14:05.129 8761-8809/com.shrey.ekka I/OpenGLRenderer: Initialized EGL, version 1.4
07-10 15:14:05.129 8761-8809/com.shrey.ekka W/OpenGLRenderer: Failed to choose config with EGL_SWAP_behavior_PRESERVED, retrying without...
07-10 15:14:05.131 8761-8809/com.shrey.ekka D/EGL_emulation: eglCreateContext: 0xaa8d4080: maj 3 min 0 rcv 3
07-10 15:14:05.132 8761-8809/com.shrey.ekka D/EGL_emulation: eglMakeCurrent: 0xaa8d4080: ver 3 0 (tinfo 0xaa8c9f10)
07-10 15:14:05.133 8761-8809/com.shrey.ekka E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008cdf
07-10 15:14:05.133 8761-8809/com.shrey.ekka E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008824
07-10 15:14:05.145 8761-8809/com.shrey.ekka D/EGL_emulation: eglMakeCurrent: 0xaa8d4080: ver 3 0 (tinfo 0xaa8c9f10)
07-10 15:14:05.181 8761-8761/com.shrey.ekka W/art: Before Android 4.1, method int androidx.appcompat.widget.DropDownListView.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
07-10 15:14:05.284 8761-8800/com.shrey.ekka D/FA: Connected to remote service
07-10 15:14:05.285 8761-8800/com.shrey.ekka V/FA: Processing queued up service tasks: 4
07-10 15:14:10.365 8761-8800/com.shrey.ekka V/FA: Inactivity, disconnecting from the service



View Postshhr3y, on 10 July 2019 - 03:05 AM, said:

I've be currently getting the same error every single time I debug my application in the emulator on Android Studio. The error is, "Unfortunately, app has stopped." I'm not sure what is wrong at all because I've searched it up to see if anything could help but didn't work.


As soon as I open My Profile on emulator the app don't show user information from the firebase database and after 2-3 sec the app crashes.
If you could please take a minute to look through my code and logcat to see if you can find a solution for my error. Thank you so much.



This is my ProfileActivity
package com.shrey.ekka;

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

import android.os.Bundle;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;

public class ProfileActivity extends AppCompatActivity {
    private TextView profile_fname, profile_lname, profile_email, profile_phone;
    private Button edit_details;
    private FirebaseAuth Auth ;
    private FirebaseDatabase Database;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_profile);

        profile_fname = findViewById(R.id.user_fname);
        profile_lname = findViewById(R.id.user_lname);
        profile_email = findViewById(R.id.user_email);
        profile_phone = findViewById(R.id.user_phone_num);
        edit_details = findViewById(R.id.edit_details);

        Auth = FirebaseAuth.getInstance();
        Database = FirebaseDatabase.getInstance();

        DatabaseReference reference = Database.getReference(Auth.getUid());

        reference.addValueEventListener(new ValueEventListener() {
            @Override
            public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
                UserProfile profile = dataSnapshot.getValue(UserProfile.class);
                profile_fname.setText(profile.getUserfname());
                profile_lname.setText(profile.getUserlname());
                profile_email.setText(profile.getUseremail());
                profile_phone.setText(profile.getUserphone());
            }

            @Override
            public void onCancelled(@NonNull DatabaseError databaseError) {
                Toast.makeText(ProfileActivity.this, "Data could not be Retrieved" + databaseError.getDetails(), Toast.LENGTH_SHORT).show();
            }
        });
    }
}





This is my UserProfile

package com.shrey.ekka;

public class UserProfile {
    public String userfname,userlname,useremail,userphone;

    public UserProfile(){
    }

    public UserProfile(String userfname, String userlname, String useremail, String userphone) {
        this.userfname = userfname;
        this.userlname = userlname;
        this.useremail = useremail;
        this.userphone = userphone;
    }


    public String getUserfname() {
        return userfname;
    }

    public void setUserfname(String userfname) {
        this.userfname = userfname;
    }

    public String getUserlname() {
        return userlname;
    }

    public void setUserlname(String userlname) {
        this.userlname = userlname;
    }

    public String getUseremail() {
        return useremail;
    }

    public void setUseremail(String useremail) {
        this.useremail = useremail;
    }

    public String getUserphone() {
        return userphone;
    }

    public void setUserphone(String userphone) {
        this.userphone = userphone;
    }
}




This is my Start
package com.shrey.ekka;

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

import android.content.Intent;
import android.os.Bundle;

import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;

import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;

public class Start extends AppCompatActivity
{
private ImageButton customize,recommended,celebrities,previous;
private Button my_profile;
private TextView hey;
private FirebaseAuth Auth ;
private FirebaseDatabase Database;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_start);

        customize = findViewById(R.id.customize);
        customize.setonclickListener(new View.onclickListener() {
            @Override
            public void onclick(View view) {
                opentrim();
            }
        });
        recommended = findViewById(R.id.recom);
        recommended.setonclickListener(new View.onclickListener() {
            @Override
            public void onclick(View view) {
                openrecom();
            }
        });
        celebrities = findViewById(R.id.celeb);
        celebrities.setonclickListener(new View.onclickListener() {
            @Override
            public void onclick(View view) {
                openceleb();
            }
        });
        previous = findViewById(R.id.prev);
        previous.setonclickListener(new View.onclickListener() {
            @Override
            public void onclick(View view) {
                openprev();
            }
        });

        my_profile = findViewById(R.id.my_profile);
        my_profile.setonclickListener(new View.onclickListener() {
            @Override
            public void onclick(View view) {
                Intent my_profile = new Intent(Start.this, ProfileActivity.class);
                startActivity(my_profile);
            }
        });

        hey = findViewById(R.id.hey);
        Auth = FirebaseAuth.getInstance();
        Database = FirebaseDatabase.getInstance();

        DatabaseReference reference = Database.getReference(Auth.getUid());

        reference.addValueEventListener(new ValueEventListener() {
            @Override
            public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
                UserProfile profile = dataSnapshot.getValue(UserProfile.class);
                hey.setText(profile.getUserfname());
            }

            @Override
            public void onCancelled(@NonNull DatabaseError databaseError) {
                Toast.makeText(Start.this, "Data could not be Retrieved" + databaseError.getDetails(), Toast.LENGTH_SHORT).show();
            }
        });



    }
    public void opentrim(){
        Intent trim = new Intent(this, Customize.class);
        startActivity(trim);
    }
    public void openrecom(){
        Intent recommend = new Intent(this, Recommend.class);
        startActivity(recommend);
    }
    public void openceleb(){
        Intent celeb = new Intent(this, Celebrities.class);
        startActivity(celeb);
    }
    public void openprev(){
        Intent previous = new Intent(this, Previous.class);
        startActivity(previous);
    }


}




This is my Signup

package com.shrey.ekka;

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

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;

public class Signup extends AppCompatActivity
{
    private String fname, lname, user_pass, ruser_pass, email,phone;
    private TextView please_details;
    private EditText fname_input, lname_input, user_pass_input, ruser_pass_input, phone_input, email_input;
    private Button confirm,face_shape;
    private FirebaseAuth Auth;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_signup);


        please_details = findViewById(R.id.enter_details);
        fname_input = findViewById(R.id.firstname);
        lname_input = findViewById(R.id.lastname);
        email_input = findViewById(R.id.email);
        user_pass_input = findViewById(R.id.npassword);
        ruser_pass_input = findViewById(R.id.nrpassword);
        phone_input = findViewById(R.id.pnumber);

        Auth = FirebaseAuth.getInstance();

        confirm = findViewById(R.id.confirm);
        confirm.setonclickListener(new View.onclickListener() {
            @Override
            public void onclick(View view) {
                fname = fname_input.getText().toString().trim();
                lname = lname_input.getText().toString().trim();
                user_pass = user_pass_input.getText().toString().trim();
                ruser_pass = ruser_pass_input.getText().toString().trim();
                email = email_input.getText().toString().trim();
                phone = phone_input.getText().toString().trim();

                if (String.valueOf(user_pass).equals(String.valueOf(ruser_pass)))
                {
                    Authen();
                    sendData();
                }
                else {
                    Toast.makeText(Signup.this, "Password didn't Match",Toast.LENGTH_SHORT).show();
                }
            }
        });

        face_shape = findViewById(R.id.face_shape_button);
        face_shape.setonclickListener(new View.onclickListener() {
            @Override
            public void onclick(View view) {
                openFaceShape();
            }
        });
    }
    public void toast(String text){
        Toast.makeText(Signup.this, text, Toast.LENGTH_SHORT).show();
    }
    public void openLogin() {
        Intent login = new Intent(this, MainActivity.class);
        startActivity(login);
    }
    public void openFaceShape() {
    Intent faces = new Intent(this, FaceShape.class);
    startActivity(faces);
    }
    public void Authen() {

        Auth.createUserWithEmailAndPassword(email,user_pass).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
            @Override
            public void onComplete(@NonNull Task<AuthResult> task) {
                if (task.isSuccessful()) {
                    Toast.makeText(Signup.this, "Registration Complete", Toast.LENGTH_SHORT).show();
                    openLogin();
                } else {
                    Toast.makeText(Signup.this, "Registration Failed", Toast.LENGTH_SHORT).show();
                }
            }
        });
    }

    public void sendData() {
        FirebaseDatabase data = FirebaseDatabase.getInstance();
        DatabaseReference myRef = data.getReference(Auth.getUid());
        UserProfile profile = new UserProfile(fname,lname,email,phone);
        myRef.setValue(profile, new DatabaseReference.CompletionListener() {
            @Override
            public void onComplete(@Nullable DatabaseError databaseError, @NonNull DatabaseReference databaseReference) {
                if (databaseError != null) {
                    Toast.makeText(Signup.this, "Data could not be saved" + databaseError.getMessage(), Toast.LENGTH_SHORT).show();
                } else {
                    Toast.makeText(Signup.this, "Data saved successfully.", Toast.LENGTH_SHORT).show();
                }
            }
        });
    }
}






And this is my Logcat

07-10 15:14:04.395 8761-8761/? I/art: Not late-enabling -Xcheck:jni (already on)
07-10 15:14:04.455 8761-8761/com.shrey.ekka W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.shrey.ekka-2/split_lib_dependencies_apk.apk --oat-file=/data/dalvik-cache/x86/[email protected]@[email protected][email protected]) because non-0 exit status
07-10 15:14:04.605 8761-8761/com.shrey.ekka W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.shrey.ekka-2/split_lib_slice_0_apk.apk --oat-file=/data/dalvik-cache/x86/[email protected]@[email protected][email protected]) because non-0 exit status
07-10 15:14:04.614 8761-8761/com.shrey.ekka W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.shrey.ekka-2/split_lib_slice_1_apk.apk --oat-file=/data/dalvik-cache/x86/[email protected]@[email protected][email protected]) because non-0 exit status
07-10 15:14:04.631 8761-8761/com.shrey.ekka W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.shrey.ekka-2/split_lib_slice_2_apk.apk --oat-file=/data/dalvik-cache/x86/[email protected]@[email protected][email protected]) because non-0 exit status
07-10 15:14:04.644 8761-8761/com.shrey.ekka W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.shrey.ekka-2/split_lib_slice_3_apk.apk --oat-file=/data/dalvik-cache/x86/[email protected]@[email protected][email protected]) because non-0 exit status
07-10 15:14:04.656 8761-8761/com.shrey.ekka W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.shrey.ekka-2/split_lib_slice_4_apk.apk --oat-file=/data/dalvik-cache/x86/[email protected]@[email protected][email protected]) because non-0 exit status
07-10 15:14:04.666 8761-8761/com.shrey.ekka W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.shrey.ekka-2/split_lib_slice_5_apk.apk --oat-file=/data/dalvik-cache/x86/[email protected]@[email protected][email protected]) because non-0 exit status
07-10 15:14:04.675 8761-8761/com.shrey.ekka W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.shrey.ekka-2/split_lib_slice_6_apk.apk --oat-file=/data/dalvik-cache/x86/[email protected]@[email protected][email protected]) because non-0 exit status
07-10 15:14:04.686 8761-8761/com.shrey.ekka W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.shrey.ekka-2/split_lib_slice_7_apk.apk --oat-file=/data/dalvik-cache/x86/[email protected]@[email protected][email protected]) because non-0 exit status
07-10 15:14:04.696 8761-8761/com.shrey.ekka W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.shrey.ekka-2/split_lib_slice_8_apk.apk --oat-file=/data/dalvik-cache/x86/[email protected]@[email protected][email protected]) because non-0 exit status
07-10 15:14:04.708 8761-8761/com.shrey.ekka W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.shrey.ekka-2/split_lib_slice_9_apk.apk --oat-file=/data/dalvik-cache/x86/[email protected]@[email protected][email protected]) because non-0 exit status
07-10 15:14:04.709 8761-8761/com.shrey.ekka W/System: ClassLoader referenced unknown path: /data/app/com.shrey.ekka-2/lib/x86
07-10 15:14:04.821 8761-8761/com.shrey.ekka V/FA: Registered activity lifecycle callback
07-10 15:14:04.863 8761-8803/com.shrey.ekka W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
07-10 15:14:04.878 8761-8761/com.shrey.ekka D/FirebaseAuth: Notifying id token listeners about user ( X4Pu9oUOGgPLwsL5gapZWQqgze73 ).
07-10 15:14:04.887 8761-8761/com.shrey.ekka I/FirebaseInitProvider: FirebaseApp initialization successful
07-10 15:14:04.889 8761-8761/com.shrey.ekka I/InstantRun: starting instant run server: is main process
07-10 15:14:04.898 8761-8800/com.shrey.ekka V/FA: App package, google app id: com.shrey.ekka, 1:920547747763:android:e3d6e85881651b77
07-10 15:14:04.899 8761-8800/com.shrey.ekka I/FA: App measurement is starting up, version: 16250
07-10 15:14:04.899 8761-8800/com.shrey.ekka I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
07-10 15:14:04.899 8761-8800/com.shrey.ekka I/FA: To enable faster debug mode event logging run:
      adb shell setprop debug.firebase.analytics.app com.shrey.ekka
07-10 15:14:04.899 8761-8800/com.shrey.ekka D/FA: Debug-level message logging enabled
07-10 15:14:04.917 8761-8805/com.shrey.ekka W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
07-10 15:14:04.929 8761-8805/com.shrey.ekka I/FirebaseAuth: [FirebaseAuth:] Loading module via FirebaseOptions.
07-10 15:14:04.929 8761-8805/com.shrey.ekka I/FirebaseAuth: [FirebaseAuth:] Preparing to create service connection to gms implementation
07-10 15:14:04.943 8761-8800/com.shrey.ekka V/FA: Connection attempt already in progress
07-10 15:14:04.953 8761-8761/com.shrey.ekka W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter androidx.vectordrawable.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
07-10 15:14:04.972 8761-8761/com.shrey.ekka V/FA: onActivityCreated
07-10 15:14:04.992 8761-8761/com.shrey.ekka I/art: Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>
07-10 15:14:04.992 8761-8761/com.shrey.ekka I/art: Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>
07-10 15:14:05.060 8761-8800/com.shrey.ekka I/FA: Tag Manager is not found and thus will not be used
07-10 15:14:05.064 8761-8800/com.shrey.ekka D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_screen_class(_sc)=MainActivity, firebase_screen_id(_si)=-3829671836164239926}]
07-10 15:14:05.073 8761-8809/com.shrey.ekka D/OpenGLRenderer: Use EGL_SWAP_behavior_PRESERVED: true
07-10 15:14:05.087 8761-8800/com.shrey.ekka V/FA: Connection attempt already in progress
07-10 15:14:05.088 8761-8800/com.shrey.ekka V/FA: Connection attempt already in progress
07-10 15:14:05.089 8761-8800/com.shrey.ekka V/FA: Activity resumed, time: 13321617
07-10 15:14:05.129 8761-8809/com.shrey.ekka I/OpenGLRenderer: Initialized EGL, version 1.4
07-10 15:14:05.129 8761-8809/com.shrey.ekka W/OpenGLRenderer: Failed to choose config with EGL_SWAP_behavior_PRESERVED, retrying without...
07-10 15:14:05.131 8761-8809/com.shrey.ekka D/EGL_emulation: eglCreateContext: 0xaa8d4080: maj 3 min 0 rcv 3
07-10 15:14:05.132 8761-8809/com.shrey.ekka D/EGL_emulation: eglMakeCurrent: 0xaa8d4080: ver 3 0 (tinfo 0xaa8c9f10)
07-10 15:14:05.133 8761-8809/com.shrey.ekka E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008cdf
07-10 15:14:05.133 8761-8809/com.shrey.ekka E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008824
07-10 15:14:05.145 8761-8809/com.shrey.ekka D/EGL_emulation: eglMakeCurrent: 0xaa8d4080: ver 3 0 (tinfo 0xaa8c9f10)
07-10 15:14:05.181 8761-8761/com.shrey.ekka W/art: Before Android 4.1, method int androidx.appcompat.widget.DropDownListView.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
07-10 15:14:05.284 8761-8800/com.shrey.ekka D/FA: Connected to remote service
07-10 15:14:05.285 8761-8800/com.shrey.ekka V/FA: Processing queued up service tasks: 4
07-10 15:14:10.365 8761-8800/com.shrey.ekka V/FA: Inactivity, disconnecting from the service



As soon as I open My Profile on emulator the app don't show user information from the firebase database and after 2-3 sec the app crashes.

Attached image(s)

  • Attached Image


Is This A Good Question/Topic? 0
  • +

Page 1 of 1