1

I have tried this post

Remove all unused classes,methods from Android Studio project

We can find some of unused classes by the method mentioned in the post:

Analyze -> Run inspection by name...-> Unused declaration

Since our project is using Hilt framework, hilt would generate XXX_GeneratedInjector something that use the unused classes. Doing the inspection would not find the unused classes in this case. Is there any way to find unused classes in project using Hilt?

RedSIght
  • 538
  • 5
  • 13
  • Can I know why you finding unused classes? and what do you want to do with them? – M DEV Jul 11 '22 at 05:23
  • @MDEV Just wanna remove them to make code base cleaner – RedSIght Jul 11 '22 at 07:08
  • I recommended you enable the R8 guard. It'll automatically remove unused files, and classes from your app and decrease the size of your app. See here https://stackoverflow.com/a/57766219/16765223 and don't forget to use `@Keep` in your model classes (Pojo class). – M DEV Jul 11 '22 at 07:24
  • @MDEV Thanks! I will try it out. But I also want my project to be clean, not only the apk. – RedSIght Jul 11 '22 at 08:01
  • It clean your app and remove unused code from app but not work for cleaning your project code. If refactor is not working then wait for someone else answer. – M DEV Jul 11 '22 at 08:06

0 Answers0