Can drywall be applied on top of the foil?

Only if there is an air gap in the assembly; typically the air gap would be between the outer layer and the foil layer. If you are placing the drywall directly on top of the foil, then the other side of the foil must be open to an air gap, not insulation or some other material. See photos of radiant barrier installed in walls with drywall/sheetrock.