So, I have an Android application and while building its release flavor I’m getting
Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated...
And
Missing class company.android.libs.camcorder.presentation.CamcorderActivity_GeneratedInjector (referenced from: in.company.android.application.CompanyApplication_HiltComponents$ActivityC)
Missing class company.android.libs.camcorder.presentation.capture.CamcorderFragment_GeneratedInjector (referenced from: in.company.android.application.CompanyApplication_HiltComponents$FragmentC)
Missing class company.android.libs.camcorder.presentation.capture.CamcorderViewModel (referenced from: java.lang.Object in.company.android.application.DaggerCompanyApplication_HiltComponents_SingletonC$ViewModelCImpl$SwitchingProvider.get())
Missing class company.android.libs.camcorder.presentation.capture.CamcorderViewModel_HiltModules$KeyModule (referenced from: java.util.Map in.company.android.application.DaggerCompanyApplication_HiltComponents_SingletonC$ActivityCImpl.getViewModelKeys())
Missing class company.android.libs.camcorder.presentation.chooser.IntentChooserBottomSheetFragment$ChooserEventTracker (referenced from: void in.company.android.features.home.MainActivity.openMediaPicker(in.company.android.libs.MediaPickerHandler$Request) and 6 other contexts)
Missing class company.android.libs.camcorder.presentation.chooser.IntentChooserBottomSheetFragment$Companion (referenced from: void in.company.android.features.home.MainActivity.openMediaPicker(in.company.android.libs.MediaPickerHandler$Request) and 4 other contexts)
Missing class company.android.libs.camcorder.presentation.chooser.IntentChooserBottomSheetFragment (referenced from: void in.company.android.features.home.MainActivity.openMediaPicker(in.company.android.libs.MediaPickerHandler$Request) and 4 other contexts)
Missing class company.android.libs.camcorder.types.CaptureMode (referenced from: company.android.libs.camcorder.types.CaptureMode in.company.android.libs.MediaPickerHandler$Request.captureMode and 15 other contexts)
Missing class company.android.transcoder.MediaProcessor (referenced from: company.android.transcoder.MediaProcessor in.company.android.features.MediaProcessorViewModel.mMediaProcessor and 7 other contexts)
Missing class in.company.library.videocompression.MediaProcessor (referenced from: in.company.library.videocompression.MediaProcessor in.company.android.features.home.MainActivityViewModel$mediaProcessor$2.invoke() and 3 other contexts)
Missing class in.company.library.videocompression.data.MediaErrorType (referenced from: void in.company.android.features.home.MainActivity.onActivityResult(int, int, android.content.Intent))
Missing class in.company.library.videocompression.data.UploadClient (referenced from: void in.company.android.features.home.AppJavascriptInterface.openVideoUploader() and 3 other contexts)
Missing class in.company.library.videocompression.listener.MediaProcessingListener (referenced from: void in.company.android.features.home.MainActivityViewModel.startMediaProcessing(android.net.Uri, in.company.library.videocompression.data.UploadClient, int) and 1 other context)
The application works fine with the debug build. Also, the application used to build fine before updating the Hilt(from 2.42
to 2.51.1
) and Gradle(from 8.2.1
to 8.6
) versions.
Do I need to add any new rules to the pro-guard file?
I tried adding these rules but it made no difference.
# Keep Hilt generated classes
-keep class dagger.hilt.internal.aggregatedroot.codegen.** { *; }
-keep class dagger.hilt.android.internal.lifecycle.HiltWrapper_** { *; }
-keep class dagger.hilt.internal.GeneratedComponent { *; }
-keep class dagger.hilt.internal.**_Factory { *; }
-keep class * extends dagger.hilt.internal.GeneratedComponent { *; }
# Keep Hilt components
-keep class dagger.hilt.components.** { *; }
-keep class dagger.hilt.android.components.** { *; }
-keep class dagger.hilt.processor.internal.** { *; }
-keep class dagger.hilt.internal.** { *; }
-keep class dagger.hilt.codegen.** { *; }
-keep class dagger.hilt.processor.internal.aggregateddeps.** { *; }
# Keep any @Inject annotated classes
-keep @javax.inject.Inject class * { <init>(...); }
# Keep any @Module annotated classes
-keep @dagger.Module class *
# Keep any @Component annotated classes
-keep @dagger.hilt.InstallIn class *
# Keep Hilt AndroidX ViewModel related code
-keep class androidx.hilt.lifecycle.HiltViewModelFactory { *; }
# Keep Hilt AndroidX Activity related code
-keep class dagger.hilt.android.internal.managers.** { *; }
-keep class dagger.hilt.android.internal.lifecycle.** { *; }
-keep class dagger.hilt.android.internal.builders.** { *; }
-keep class dagger.hilt.android.internal.** { *; }
# Keep any @HiltAndroidApp annotated classes
-keep @dagger.hilt.android.HiltAndroidApp class *