2021-08-14 19:43:53.129 8682-8682/com.future.vpn E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.future.vpn, PID: 8682
java.lang.NullPointerException: Attempt to invoke virtual method ‘boolean java.lang.String.equals(java.lang.Object)’ on a null object reference
at com.future.vpn.Activities.MainActivity.onStart(MainActivity.java:186)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1435)
at android.app.Activity.performStart(Activity.java:8024)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3475)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
2021-08-14 19:43:53.186 8682-8682/com.future.vpn I/Process: Sending signal. PID: 8682 SIG: 9
Question posted in Android Studio
The official documentation can be found here.
The official documentation can be found here.
2
Answers
This is a NullPointerException, you are passing a null value. Place break points on the sections that contain variables/values then run it (using the Debug feature on). This will show you:
Start from there, and it would be best you share the code snippet to make it more elaborate.
In
onstart()
Method you have a string that is not initialized and you are comparing it with another string that’s why you are getting this error.first, initialize string then compare with another string