First you have to check that the polyaniline is soluble or not in water. If soluble then how extent it is soluble? If it is highly soluble then very less chance to get pure hydrogel because overall hydrophilic and hydrophobic interactions must be balanced to get hydrogel. If the polyaniline is less soluble in water then you can add any water miscible hyghly polar solvent drop wise just to dissolve the polyaniline under hot condition and let it cool to room temperature, then you may get aqueous gel.
Another way is that you try to synthesize polyaniline in situ in aqueous medium under various concentration because gel formation depends on the concentration of gelator (it should be above MGC- minimum gelator concentration).
If it does not form gel, then you can add external gel inducing molecules that is suitable for your system.
Polyaniline is not water soluble - at most it's slightly soluble in chloroform, dimethyl acetamide/formamide, formic acid and few phenolic solvents - but only if properly doped with organic acids (mostly bulk surfactants). To prepare hydrogels, you must synthesize PANI in situ; aniline hydrochoride is soluble in water and can be the source of aniline monomer; other salts can be used, ensuring the acid precursor renders the complex with aniline soluble. Take care to not oxidize other components of the hydrogel.
You will get a mixture of dispersed PANI grains in the hydrogel, or a gel grafted with short PANI chains.
From a practical approach: try to swell a gel with a solution of aniline hydrochloride and after add (slowly - reaction is exothermic) a solution of ammonium persulfate or other suitable oxidant to promote polimerization of PANI chains inside the gel. Don't forget it will be highly acidic, not all hydrogels will remain stable under such condition.