NOVELTY - Preparation of avanafil (I) includes halogenating uracil-containing compound (X) to obtain 2,4-dihalogen-5-pyrimidine-containing compound (XI), reacting with 3-chloro-4-methoxybenzylamine (II) or its salt to carry out substitution reaction to obtain 2-halo-4-(3-chloro-4-methoxybenzylamino)-5-pyrimidin-containing compound (XII), separating and purifying; and reacting with L-prolinol (VI) to carry out substitution reaction, and aminolyzing with 2-pyrimidinemethanamine (IX) or its salt.    USE - Method for preparation of avanafil (claimed).    ADVANTAGE - The method is environment-friendly and suitable for industrial large scale production, and it has lower cost, simple operation, mild reaction condition, and high yield.    DETAILED DESCRIPTION - Preparation of avanafil of formula (I) comprises:    (1) halogenating uracil-containing compound of formula (X) to obtain 2,4-dihalogen-5-pyrimidine-containing compound of formula (XI), reacting with 3-chloro-4-methoxybenzylamine of formula (II) or its salt to carry out substitution reaction to obtain 2-halo-4-(3-chloro-4-methoxybenzylamino)-5-pyrimidin-containing compound of formula (XII), separating and purifying; and reacting with L-prolinol of formula (VI) to carry out substitution reaction to obtain L-prolinol-containing compound of formula (VII), and aminolyzing with 2-pyrimidinemethanamine of formula (IX) or its salt; or hydrolyzing compound (VII) with an acid to obtain carboxylic acid-containing compound of formula (VIII), and reacting with compound (IX) or its salt to carry out amidation reaction;    (2) subjecting 5-uracil carboxylate of formula (XIII) and compound (IX) or its salt to amidation reaction or subjecting compound (X) and compound (IX) or its salt to ammonolysis reaction, reacting with halogenated compound to obtain halogen-containing compound of formula (XV); and reacting with compound (II) or its salt to obtain N-benzylpyrimidin-4-amine-containing compound of formula (XVI), and reacting with compound (VI); and    (3) subjecting compound (VIII) and carboxylic acid to activation reaction to obtain halogenated pyrimidine-containing compound of formula (XVII), reacting with compound (IX) or its salt to obtain compound (XV), reacting with compound (II) to obtain compound (XVI), and performing substitution reaction with compound (VI).    R=1-6C straight or branched chain alkyl, preferably Me, Et or t-butyl; and    X=halo, preferably Cl or Br.