https://kotlinlang.org logo
#dagger
Title
r

rkeazor

09/04/2021, 11:17 AM
Hey DaggerHeads, im running into a issue where hilt doesn't allow BaseClasses with default values. For Example
Copy code
abstract class BaseActivity(layouId: Int = 0) // Hilt complains that default value of 0 is not allowed
1
f

FunkyMuse

09/04/2021, 1:24 PM
This isn't a Hilt issue, unless you're injecting that BaseActivity class which is a bad idea
r

rkeazor

09/04/2021, 3:46 PM
@FunkyMuse this is the error message
Copy code
The base class, 'com.example.android.dagger.registration.BaseActivity', of the @AndroidEntryPoint, 'com.example.android.dagger.login.LoginActivity', contains a constructor with default parameters. This is currently not supported by the Gradle plugin. Either specify the base class as described at <https://dagger.dev/hilt/gradle-setup#why-use-the-plugin> or remove the default value declaration.
  [Hilt] Processing did not complete. See e
f

FunkyMuse

09/04/2021, 3:49 PM
Welp the solution is offered to you by Hilt and also having a default parameter for a base class is a bad idea nevertheless
r

rkeazor

09/04/2021, 4:30 PM
why you say that @FunkyMuse
why is it a bad idea @FunkyMuse?
3 Views