The Israelites were living according to their own standards all the while trying to say that they were living for God. Then they were shocked that they weren’t receiving his blessings. 
But here is the thing: the Lord won’t condone sin just because you want him to. He won’t bless unrighteousness to give you a pat on the back for “giving it a good try”. 
Always live according to his will and Word in spite of your flesh. Because our God is just. He is holy. Take comfort in knowing that he truly wants what is best for you. 
Scripture taken from: Isaiah 58