Galileo got into trouble because he maintained that since the new discoveries seemed to contradict scripture, those passages of scripture should be reinterpreted in a metaphorical way. He did not seek to oppose the Church nor to doubt the inspiration of scripture. The problem is that he abandoned science and started talking theology and so attracted the notice of the Roman Inquisition. If he had left theology out of his writings and discussions he would probably never have had problems. And he remained a faithful and devout Catholic to the end of his life.