6-amino quinazoline or 3-cyano quinoline derivatives, preparation methods and pharmaceutical uses thereof are disclosed. Specifically, the present disclosure discloses novel 6-amino quinazoline or 3-cyano quinoline derivatives presented by general formula (I), or tautomers, enantiomers, diastereomers, racemates or pharmaceutically acceptable salts thereof, or metabolites, metabolic precursors or prodrugs thereof, and their uses as treatment agents especially as protein kinase inhibitors, in which each substitute group of general formula (I) is as defined in the specification.