The present invention disclosed a class of pyrimidine or pyridine compounds, pharmaceutically acceptable salts, stereoisomers, prodrugs and solvates thereof, preparation method therefor and pharmaceutical compositions and pharmaceutical uses thereof. See e.g., Formula I below. The compounds can inhibit the variants of EGFR (Epidermis Growth Factor Receptor) proteinases, and therefore can inhibit the growth of a variety of tumor cells effectively. The compounds can be used to prepare antitumor drugs, used for the treatment, combined therapy or prevention of various different cancers. The compounds can overcome the drug resistance induced by the existing first-generation EGFR inhibitors such as gefitinib, erlotinib and so on. Particularly, the compounds can be used to prepare drugs for treating or preventing diseases, disturbances, disorders or conditions mediated by epidermis growth factor receptor variants (such as L858R activated mutants, Exon19 deletion activated mutants and T790M resistant mutants).