Removing used packages during ProGuard optimisation

During the Proguard optimization ,removing too much of data .
very recent we have upgraded gradle wrapper from 4 to 5.4.1 and class path 2.2.3 to 3.5.4
and keeping same dependency versions in gradle files .
we found the removed used files and specified with -keep rules in the ProGuard configuration.
but its hard to do this job. is there any possible way to keep used files and Android packages .