How to solve invalid IMEI problem in LG G3? After performing a factory reset on my LG G3, my IMEI was set to 0. This problem has been reported also in xda-forums.

How to reset the IMEI in LG G3 running on Android Marshmallow 6.0?
A solution for this problem has been given in multiple sources, such as: this, this, and this. However, in those cases either the phone model is different, or the Android version on the device is different.

Solving this problem requires couple of steps:

0) Setup description

1) Accessing the hidden menu for LG G3 on Android Marshmallow 6.0 &amp; enable DIAG MODE

The solution for this is given in the following xda post

Basically, following steps 1-7 from that post was sufficient for me (given that I had installed the latest version of LG drivers: LGMobileDriver_WHQL_Ver_4.2.0.exe)


  
  Download LG United Mobile Driver or LG Mobile Driver. (I don't think it matters.
  Install it.
  Go to Device Manager on your Windows Machine.
  Physically Connect your phone to the computer and set it to CHARGE ONLY (This is necessary).
  , Then Go to your phone Dialer PAD and type in the code: *#546368#*855# (Replace 855 with the LG G3 model Number - 855 is the international model)
  
  
  It should automatically launch you to the hidden Menu.
  
  Navigate to USB > PORT CHECK TEST. (Not sure if this is necessary at all...but won't hurt to enable it anyway.. you may skip this or
  not..it depends..idk)
  
  
  Enable it
  
  Then Navigate back to USB > QMICMSet
  
  
  Click 'OK'. ( Immediately you should see TWO Notifications Display: "LGE Android Phone" Under "Other Devices" with a yellow exclamation.
  
  


2) Use QPST to modify the IMEI

For this you have to use the proper version of QPST, that is: 2.7.378. The required software can be found here: http://www.mediafire.com/file/figdbxb75j5kyry/package.rar

For the remaining steps you can follow everything after 06:00 from the afore-mentioned video (https://www.youtube.com/watch?v=y2lHFy7AciE), or steps 1-28 after this line:


  [After it you will have a 2G network but no 3G\4G network because of
  the imei of the device is 0.So you must restore it with QPST.


in this post: https://forum.xda-developers.com/lg-g3/general/service-disabled-current-version-t3403232


  
  Make sure you LG G3 is running the stock LG firmware [..] If your phone does not have official firmware
  installed on it, restore it to stock first. Install the latest LG USB
  drivers on your computer.
  Now download the IMEI converter tool and unzip it.
  Download QPST (Qualcomm Product Support Tools) and unzip it.
  Open the QPST_2.7_378 and run the setup file to install it on your computer.
  Enable USB debugging on your device. You can find this option under Settings> Developer options. Connect your device to the computer.
  Run QPST configuration and click on Ports tab. Click on Add new port option.
  Your current port should show as COM4/5.
  Select the port and click OK. The port should come up on active phones.
  Select the phone and click the Software Download option from Start clients menu.
  Now click on Backup tab. You should see your phone’s port.
  Click on Start to initiate backup.
  Now navigate to C:/ Program Files/ qualcomm/ qpst/bin folder.
  Run RF_NV_Manager.
  Click File> Read from phone. Your phone’s IMEI number should appear on number 550; NV_IMEI_I
  If you do not see item 550, do not panic.
  Click on File> Read supported RF NV items.
  Click on item 550. You would see 9 blank fields.
  Now run IMEI Converter.exe.
  Now type your phone’s IMEI in Enter IMEI field. You can find your IMEI on your phone’s bill or the box your device came in.
  Then click on  button.
  You should see 18 digits in groups of 9.
  In RF_NV_Manager program, click on Hex by Write NV button.
  In the 9 boxes, type in the numbers from IMEI converter starting from left. Type in first group of two numbers in the first field, then
  go to the next field and type in second 2 digits.
  When you are done with doing this, click on Write NV option.
  Then click File> Read from phone.
  Item number 550 should appear now.
  Disconnect the USB cable and reboot it.
  Open phone’s dialer and dial *#06#. You should see your phone’s IMEI now.
  


Credit for the solution goes to the original authors in xda and yt, I just put together their stuff.