Production of a semiconductor device comprises forming a polyimide based resin layer as intermediate insulating layer and coating the resin layer with an insulating layer. During the process, permeation of reaction products originating from the amidation, on heating the polyimide-based resin layer to a prescribed temperature before heat treating to degas the resin layer.