About the author

Akshay Raj

View all posts

94 Comments

  • im using wampserver installed on my laptop and internet connected by wifi, for url i used ip address 192.168.1.2:8080 (refer to ipconfig). but when i try to RESEND CODE i got error message Json error:value

    • Add two slash (//) before mail() function for testing. You can get verification code from phpmyadmin and if you want to try mail function then add your project to online server and remove slash from mail function

  • The first user is created perfectly, but when I try to register the second user it says “Database Error2. Please Try Again!”. I removed the first user from the mysql db and it again registered the 1st user and again an error on registering the 2nd user.

      • Thank you man!
        Am having an error trying to register;
        java.lang.NullPointerException: Attempt to invoke virtual method ‘void com.waynem.kejaapp.MyApplication.addToRequestQueue(com.android.volley.Request, java.lang.String)’ on a null object reference
        Help me

        • 02-19 12:26:52.473 10195-10195/com.waynem.kejaapp E/AndroidRuntime: FATAL EXCEPTION: main
          Process: com.waynem.kejaapp, PID: 10195
          java.lang.NullPointerException: Attempt to invoke virtual method ‘void com.waynem.kejaapp.MyApplication.addToRequestQueue(com.android.volley.Request, java.lang.String)’ on a null object reference
          at com.waynem.kejaapp.RegisterActivity.registerUser(RegisterActivity.java:163)
          at com.waynem.kejaapp.RegisterActivity.access$300(RegisterActivity.java:32)
          at com.waynem.kejaapp.RegisterActivity$1.onClick(RegisterActivity.java:75)
          at android.view.View.performClick(View.java:4848)
          at android.view.View$PerformClick.run(View.java:20262)
          at android.os.Handler.handleCallback(Handler.java:815)
          at android.os.Handler.dispatchMessage(Handler.java:104)
          at android.os.Looper.loop(Looper.java:194)
          at android.app.ActivityThread.main(ActivityThread.java:5637)
          at java.lang.reflect.Method.invoke(Native Method)
          at java.lang.reflect.Method.invoke(Method.java:372)
          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

  • Sir i have executed the app but when i goto register activity then it goes to login activity and when i try to login then app crashes and closed. There is no data in mysql database. Please help me sir.

  • I have followed all the steps on the tutorial. But when I either register or login on the app it invokes the registering dialog or the login dialog but it then shows an empty dialog nothing happens there after. Please help I am already using an online server

  • Hello sir,
    In Forgot password ,when I enter email address, I am getting error [value

  • hello, In forgot password, mail is sent but not received. Below is the error log. Please help.
    [Thu May 24 10:25:34.653603 2018] [mpm_winnt:notice] [pid 10060:tid 680] AH00364: Child: All worker threads have exited.
    [Thu May 24 10:25:34.702636 2018] [mpm_winnt:notice] [pid 8924:tid 760] AH00430: Parent: Child process 10060 exited successfully.
    [Thu May 24 10:25:39.813855 2018] [ssl:warn] [pid 32:tid 740] AH01909: http://www.example.com:443:0 server certificate does NOT include an ID which matches the server name
    [Thu May 24 10:25:39.890192 2018] [ssl:warn] [pid 32:tid 740] AH01909: http://www.example.com:443:0 server certificate does NOT include an ID which matches the server name
    [Thu May 24 10:25:39.917211 2018] [mpm_winnt:notice] [pid 32:tid 740] AH00455: Apache/2.4.33 (Win32) OpenSSL/1.1.0h PHP/7.2.5 configured — resuming normal operations
    [Thu May 24 10:25:39.917211 2018] [mpm_winnt:notice] [pid 32:tid 740] AH00456: Apache Lounge VC15 Server built: Mar 28 2018 12:12:41
    [Thu May 24 10:25:39.917211 2018] [core:notice] [pid 32:tid 740] AH00094: Command line: ‘C:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache’
    [Thu May 24 10:25:39.946781 2018] [mpm_winnt:notice] [pid 32:tid 740] AH00418: Parent: Created child process 6424
    [Thu May 24 10:25:40.478289 2018] [ssl:warn] [pid 6424:tid 656] AH01909: http://www.example.com:443:0 server certificate does NOT include an ID which matches the server name
    [Thu May 24 10:25:40.537104 2018] [ssl:warn] [pid 6424:tid 656] AH01909: http://www.example.com:443:0 server certificate does NOT include an ID which matches the server name
    [Thu May 24 10:25:40.564123 2018] [mpm_winnt:notice] [pid 6424:tid 656] AH00354: Child: Starting 150 worker threads.
    sendmail: Error during delivery: Please log in via your web brows

    • mail() function does not work in local server. upload your website to real server then test mail()

      • hello Sir,
        I am getting error at b.putstring(“email”,email) in login activity,and also in getString method.
        It says, putstring cannot be resolved

  • I have made a new project and added this files. app is closing without showing any matching errors in error log.
    But your project which i have downloaded is working

  • I got this error

    W/System.err: org.json.JSONException: Value Failed of type java.lang.String cannot be converted to JSONObject
    W/System.err: at org.json.JSON.typeMismatch(JSON.java:111)
    W/System.err: at org.json.JSONObject.(JSONObject.java:160)
    W/System.err: at org.json.JSONObject.(JSONObject.java:173)
    W/System.err: at com.dugange.hilarym.androidtodatabase.RegisterActivity$3.onResponse(RegisterActivity.java:108)
    W/System.err: at com.dugange.hilarym.androidtodatabase.RegisterActivity$3.onResponse(RegisterActivity.java:100)

    Your help please

  • I got this error
    W/System.err: org.json.JSONException: Value Failed of type java.lang.String cannot be converted to JSONObject
    W/System.err: at org.json.JSON.typeMismatch(JSON.java:111)
    W/System.err: at org.json.JSONObject.(JSONObject.java:160)
    W/System.err: at org.json.JSONObject.(JSONObject.java:173)
    W/System.err: at com.dugange.hilarym.androidtodatabase.RegisterActivity$3.onResponse(RegisterActivity.java:108)
    W/System.err: at com.dugange.hilarym.androidtodatabase.RegisterActivity$3.onResponse(RegisterActivity.java:100)
    Your help please

      • I connected LAN with ipv4 address 192.168.137.1
        so changed to
        String MAIN_URL = “http://192.168.137.1/android_login/”;

        I created folder android_login pasted those php files
        I copied android project
        I created database android_login, created table users as mentioned
        Used Xampp so all inside htdocs folder
        changed username and password in config.php

        Getting error:
        E/RegisterActivity: Registration Error: null
        com.android.volley.TimeoutError
        at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:169)
        at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:120)
        at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:87)

  • Dear Mr. Akshay Raj,
    I need more information on “otp” and email verification. Could you please inform where or how can I find the above info?
    Thanks and best regards.

    • When you’ll register then you’ll receive an email with 6 digits number. you need to provide this code to email verification activity to verify email.

  • Hello,
    Everything works fine except the verification code that I do not get on my email address. I am on an external server.
    Thank you

  • Hello,
    Everything works fine except that I never receive the verification code by email.
    Can you help me
    Thank you

  • Pls the password is not resseting, and not sending anything to my mail on local server.

      • Pls which line are you talking about the mail() function
        I have another error when using forgot password
        it shows error below
        (value <br of type java.lang.string cannot be converted to jsonobject)
        Pls how will i do this

        This is the log

        ( ! ) Warning: mail(): Failed to connect to mailserver at &quot;localhost&quot; port 25, verify your &quot;SMTP&quot; and &quot;smtp_port&quot; setting in php.ini or use ini_set() in C:\wamp64\www\unilever_app\reset-password.php on line 54
        Call Stack
        #TimeMemoryFunctionLocation
        10.0010407224{main}( )…\reset-password.php:0
        20.1527460384mail
        ( )…\reset-password.php:54

        {“tag”:”forgot_pass”,”error”:false,”message”:”A new password has been sent to your e-mail address.”,”mail”:”Hello Muibi Azeez Abolade.\n\nWe received a request to change your password on Agbara Engineering App\n\nYour new password:\n\n HgFASy\n\nRegards,\nAgbara Engineering App.”}
        2020-03-19 08:20:40.173 12050-12082/org.unilever.centralengineering D/EGL_emulation: eglMakeCurrent: 0x7fa9f0637aa0: ver 3 1 (tinfo 0x7fa9f060c1a0)
        2020-03-19 08:20:40.195 12050-12050/org.unilever.centralengineering W/System.err: org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject
        2020-03-19 08:20:40.196 12050-12050/org.unilever.centralengineering W/System.err: at org.json.JSON.typeMismatch(JSON.java:111)
        2020-03-19 08:20:40.196 12050-12050/org.unilever.centralengineering W/System.err: at org.json.JSONObject.(JSONObject.java:160)
        2020-03-19 08:20:40.196 12050-12050/org.unilever.centralengineering W/System.err: at org.json.JSONObject.(JSONObject.java:173)
        2020-03-19 08:20:40.196 12050-12050/org.unilever.centralengineering W/System.err: at org.unilever.centralengineering.LoginActivity$11.onResponse(LoginActivity.java:311)
        2020-03-19 08:20:40.196 12050-12050/org.unilever.centralengineering W/System.err: at org.unilever.centralengineering.LoginActivity$11.onResponse(LoginActivity.java:303)
        2020-03-19 08:20:40.196 12050-12050/org.unilever.centralengineering W/System.err: at com.android.volley.toolbox.StringRequest.deliverResponse(StringRequest.java:78)
        2020-03-19 08:20:40.196 12050-12050/org.unilever.centralengineering W/System.err: at com.android.volley.toolbox.StringRequest.deliverResponse(StringRequest.java:30)
        2020-03-19 08:20:40.196 12050-12050/org.unilever.centralengineering W/System.err: at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:106)
        2020-03-19 08:20:40.196 12050-12050/org.unilever.centralengineering W/System.err: at android.os.Handler.handleCallback(Handler.java:751)
        2020-03-19 08:20:40.196 12050-12050/org.unilever.centralengineering W/System.err: at android.os.Handler.dispatchMessage(Handler.java:95)
        2020-03-19 08:20:40.196 12050-12050/org.unilever.centralengineering W/System.err: at android.os.Looper.loop(Looper.java:154)
        2020-03-19 08:20:40.197 12050-12050/org.unilever.centralengineering W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6125)
        2020-03-19 08:20:40.197 12050-12050/org.unilever.centralengineering W/System.err: at java.lang.reflect.Method.invoke(Native Method)
        2020-03-19 08:20:40.197 12050-12050/org.unilever.centralengineering W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:893)
        2020-03-19 08:20:40.197 12050-12050/org.unilever.centralengineering W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:783)
        2020-03-19 08:20:40.213 12050-12082/org.unilever.centralengineering D/EGL_emulation: eglMakeCurrent: 0x7fa9f0637aa0: ver 3 1 (tinfo 0x7fa9f060c1a0)
        2020-03-19 08:20:40.307 12050-12082/org.unilever.centralengineering E/EGL_emulation: tid 12082: eglSurfaceAttrib(1259): error 0x3009 (EGL_BAD_MATCH)
        2020-03-19 08:20:40.307 12050-12082/org.unilever.centralengineering W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0x7fa9dac41cc0, error=EGL_BAD_MATCH
        2020-03-19 08:20:40.307 12050-12050/org.unilever.centralengineering W/IInputConnectionWrapper: finishComposingText on inactive InputConnection
        2020-03-19 08:20:40.314 12050-12082/org.unilever.centralengineering D/EGL_emulation: eglMakeCurrent: 0x7fa9f0637aa0: ver 3 1 (tinfo 0x7fa9f060c1a0)
        2020-03-19 08:20:40.711 12050-12082/org.unilever.centralengineering D/EGL_emulation: eglMakeCurrent: 0x7fa9f0637aa0: ver 3 1 (tinfo 0x7fa9f060c1a0)

      • yes is work. !! in my first post i tell how can you do. But i use xamp with sendmail.

  • This has been depreciated on CONFIG.PHP
    if(function_exists(‘get_magic_quotes_gpc’) && get_magic_quotes_gpc()) {
    function undo_magic_quotes_gpc(&$array) {
    foreach($array as &$value) {
    if(is_array($value)) {
    undo_magic_quotes_gpc($value);
    }
    else {
    $value = stripslashes($value);
    }
    }
    }

    undo_magic_quotes_gpc($_POST);
    undo_magic_quotes_gpc($_GET);
    undo_magic_quotes_gpc($_COOKIE);
    }

  • Pls which line are you talking about the mail() function
    I have another error when using forgot password
    it shows error below
    (value <br of type java.lang.string cannot be converted to jsonobject)
    Pls how will i do this

    This is the log

    ( ! ) Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp64\www\unilever_app\reset-password.php on line 54
    Call Stack
    #TimeMemoryFunctionLocation
    10.0010407224{main}( )…\reset-password.php:0
    20.1527460384mail
    ( )…\reset-password.php:54

    {“tag”:”forgot_pass”,”error”:false,”message”:”A new password has been sent to your e-mail address.”,”mail”:”Hello Muibi Azeez Abolade.\n\nWe received a request to change your password on Agbara Engineering App\n\nYour new password:\n\n HgFASy\n\nRegards,\nAgbara Engineering App.”}
    2020-03-19 08:20:40.173 12050-12082/org.unilever.centralengineering D/EGL_emulation: eglMakeCurrent: 0x7fa9f0637aa0: ver 3 1 (tinfo 0x7fa9f060c1a0)
    2020-03-19 08:20:40.195 12050-12050/org.unilever.centralengineering W/System.err: org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject
    2020-03-19 08:20:40.196 12050-12050/org.unilever.centralengineering W/System.err: at org.json.JSON.typeMismatch(JSON.java:111)
    2020-03-19 08:20:40.196 12050-12050/org.unilever.centralengineering W/System.err: at org.json.JSONObject.(JSONObject.java:160)
    2020-03-19 08:20:40.196 12050-12050/org.unilever.centralengineering W/System.err: at org.json.JSONObject.(JSONObject.java:173)
    2020-03-19 08:20:40.196 12050-12050/org.unilever.centralengineering W/System.err: at org.unilever.centralengineering.LoginActivity$11.onResponse(LoginActivity.java:311)
    2020-03-19 08:20:40.196 12050-12050/org.unilever.centralengineering W/System.err: at org.unilever.centralengineering.LoginActivity$11.onResponse(LoginActivity.java:303)
    2020-03-19 08:20:40.196 12050-12050/org.unilever.centralengineering W/System.err: at com.android.volley.toolbox.StringRequest.deliverResponse(StringRequest.java:78)
    2020-03-19 08:20:40.196 12050-12050/org.unilever.centralengineering W/System.err: at com.android.volley.toolbox.StringRequest.deliverResponse(StringRequest.java:30)
    2020-03-19 08:20:40.196 12050-12050/org.unilever.centralengineering W/System.err: at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:106)
    2020-03-19 08:20:40.196 12050-12050/org.unilever.centralengineering W/System.err: at android.os.Handler.handleCallback(Handler.java:751)
    2020-03-19 08:20:40.196 12050-12050/org.unilever.centralengineering W/System.err: at android.os.Handler.dispatchMessage(Handler.java:95)
    2020-03-19 08:20:40.196 12050-12050/org.unilever.centralengineering W/System.err: at android.os.Looper.loop(Looper.java:154)
    2020-03-19 08:20:40.197 12050-12050/org.unilever.centralengineering W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6125)
    2020-03-19 08:20:40.197 12050-12050/org.unilever.centralengineering W/System.err: at java.lang.reflect.Method.invoke(Native Method)
    2020-03-19 08:20:40.197 12050-12050/org.unilever.centralengineering W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:893)
    2020-03-19 08:20:40.197 12050-12050/org.unilever.centralengineering W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:783)
    2020-03-19 08:20:40.213 12050-12082/org.unilever.centralengineering D/EGL_emulation: eglMakeCurrent: 0x7fa9f0637aa0: ver 3 1 (tinfo 0x7fa9f060c1a0)
    2020-03-19 08:20:40.307 12050-12082/org.unilever.centralengineering E/EGL_emulation: tid 12082: eglSurfaceAttrib(1259): error 0x3009 (EGL_BAD_MATCH)
    2020-03-19 08:20:40.307 12050-12082/org.unilever.centralengineering W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0x7fa9dac41cc0, error=EGL_BAD_MATCH
    2020-03-19 08:20:40.307 12050-12050/org.unilever.centralengineering W/IInputConnectionWrapper: finishComposingText on inactive InputConnection
    2020-03-19 08:20:40.314 12050-12082/org.unilever.centralengineering D/EGL_emulation: eglMakeCurrent: 0x7fa9f0637aa0: ver 3 1 (tinfo 0x7fa9f060c1a0)
    2020-03-19 08:20:40.711 12050-12082/org.unilever.centralengineering D/EGL_emulation: eglMakeCurrent: 0x7fa9f0637aa0: ver 3 1 (tinfo 0x7fa9f060c1a0)

  • i am using window 32 bit with xamp,
    when i run the app from my mobile and try to register no any error pop up simly try to serch for some tme and quit

      • I set my IP address to 192.168.1.2. and make change to code accordingly.
        Is there any special configuration on xamp side needed.
        How can I send you screenshoot

      • when i try to register or login from mobile after searching a little bit show me pop at bottom of interface below forgot password something like big dot.
        i am in the same wifi with local server,

          • two error log as below,
            am using Xampp Apache 2.4.29,on window 10 win 32 bit, i tried to adjust different configuration, stop window defender firewall, reinstall Xampp but still no solution.

            [Sat Apr 18 15:55:46.275274 2020] [authz_core:error] [pid 5900:tid 1896] [client 192.168.1.3:53858] AH01630: client denied by server configuration: C:/xampp/htdocs/~snow
            [Sat Apr 18 15:55:46.319409 2020] [authz_core:error] [pid 5900:tid 1896] [client 192.168.1.3:53858] AH01630: client denied by server configuration: C:/xampp/htdocs/~snow

    • did you configure xamp server?? you have to change some configuration in “php.ini” and in “sendmail.ini”.

  • For those that no have time to translate.

    Config for Xamp server

    Step 1: go to the php.ini file at the path C: \ xampp \ php \ php.ini

    Step 2: find the line; extension = php_openssl.dll and remove the semicolon

    Step 3: find the SMTP, smtp_post, sendmail_from and sendmail_path lines and put the following if you will use gmail as smtp:

    SMTP = smtp.gmail.com
    smtp_port = 587
    sendmail_from = [email protected]
    sendmail_path = “\” C: \ xampp \ sendmail \ sendmail.exe \ “-t”
    If you copy and paste be careful with the quotes because the correct quote may not be inserted.

    Step 4: open the sendmail.ini file located at the path C: \ xampp \ sendmail \ sendmail.ini and configure it as follows:

    smtp_server = smtp.gmail.com
    smtp_port = 587
    error_logfile = error.log
    debug_logfile = debug.log
    [email protected]
    auth_password = xxxxx
    [email protected]

    Step 5: if you use gmail to send emails locally you must have the account that you must activate the option “Allow less secure applications to access your account” otherwise you will not be able to send emails with gmail, I leave the link https : //support.google.com/accounts/answer/6010255? hl = en-419

  • Hello It is not sending Mail on live host. Pls help Verification and reset password.

  • Very good explanation.
    I copied all files to my project, but I’m unable to assign MyApplication as the startscreen. It refuses in the manifest files.
    What am I doing wrong?
    All compiled with success.
    Manifest file : http://prntscr.com/tpb2sd

  • I’m getting this error when trying to register:
    W/System.err: org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject
    W/System.err: at org.json.JSON.typeMismatch(JSON.java:112)
    W/System.err: at org.json.JSONObject.(JSONObject.java:169)
    at org.json.JSONObject.(JSONObject.java:182)
    at com.example.android_login.RegisterActivity.lambda$registerUser$2$RegisterActivity(RegisterActivity.java:92)
    at com.example.android_login.-$$Lambda$RegisterActivity$qdOjFYQokWmNALZZ9DYPuxf6hIc.onResponse(Unknown Source:6)
    at com.android.volley.toolbox.StringRequest.deliverResponse(StringRequest.java:78)
    at com.android.volley.toolbox.StringRequest.deliverResponse(StringRequest.java:30)
    at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:106)
    at android.os.Handler.handleCallback(Handler.java:938)
    W/System.err: at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:223)
    at android.app.ActivityThread.main(ActivityThread.java:7523)
    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:941)

  • Hello It is not sending Mail on live host. Pls help Verification and reset password. I am stuck. But i receive the otp on phpmyadmin

  • when access login.php by url message ” {“message”:”Method not supported!”} ” and second I register new user no err but data not found on mysql database . I am testing this on live server and giving live server local ip not public ip. kindly assist .