Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing variable declaration #5

Open
MichaelsPlayground opened this issue Nov 11, 2022 · 2 comments
Open

Missing variable declaration #5

MichaelsPlayground opened this issue Nov 11, 2022 · 2 comments

Comments

@MichaelsPlayground
Copy link

Hi, thanks for your wonderful contribution with this Android app - it helped me a lot in understanding how to work with Firebase.

While trying to run your I received some messages from my Android Studio (I'm running Android Studio Dolphin | 2021.3.1 Patch 1 with SDK 33).

In MessagingActivity there is a missing variable declaration:

                            String decrypted = "";
                            try {
                                decrypted = AESUtils.decrypt(msg);
                            } catch (Exception er) {
                                er.printStackTrace();
                            }

My Android Studio claimed about a lot of possible "Method invocation 'toString' may produce 'NullPointerException'" like here:

String msg = e.child("msgText").getValue().toString();

I replaced all of those with the recommended

String msg = Objects.requireNonNull(e.child("msgText").getValue()).toString();

A last note: It would be perfect if you could add a simple explanation what services are needed in the Firebase setup - it took me some time to find them all (Authentication with Email and Google, Realtime Database and Storage).

Thanks again, greetings from
Michael

@MisLead07
Copy link

I am also getting the same issue mentioned above by @MichaelsPlayground i.e. Cannot find symbol decrypted as well as Cannot find variable decrypted in the MessagingActivity Java Class

@MisLead07
Copy link

MisLead07 commented Apr 16, 2023

I am also getting the same issue mentioned above by @MichaelsPlayground i.e. Cannot find symbol decrypted as well as Cannot find variable decrypted in the MessagingActivity Java Class

Okay, so i somehow managed to get rid of this issue by creating a variable named decrypted of the type String in the MessagingActivity

But now the issue is that am not able to access the profile option in setting as the app just crashes and i get an error which states Attempt to invoke virtual method 'java.lang.String java.lang.Object.toString()' on a null object reference and the other issue is that i am not able to add users to the app (as shown in the video by the OG creator) using their email or even their usernames for reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants