A novel probe for bacteria was simply synthesized through the solvent-induced co-assembly of bacitracin (AMP) and thymolphthalein (TP) without complicated modification. Combining with aptamer-Fe3O4, AMP/TP nanoparticles were used for the colorimetric detection of Escherichia coli with good sensitivity through the NaOH-triggered blue color and a smartphone-based App.