I had this similar issue and in my case it was caused by a bad aggregation Design in one of the measure group, once the deleted that aggregation design, the solution started building fine without any error of "object reference not set to an instance". if you are using multiple aggregation designs in your OLAP cube then try to remove them one by one to figure out which one is causing this issue.
(Pls. take a backup of your CUBE schema or do it in a test environment.)
Some time aggregation design cracks when you choose to do a FULL aggregation for those attribute which have lot of members. This is very frustrating to see that error without any context why it is braking.