Issue
I want to add dagger-hilt plugin to project.
classpath 'com.google.dagger:hilt-android-gradle-plugin:2.40.5'
https://developer.android.com/studio/preview/features#settings-gradle
plugins {
id 'com.android.application' version '7.1.0-beta02' apply false
id 'com.android.library' version '7.1.0-beta02' apply false
id 'org.jetbrains.kotlin.android' version '1.5.30' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = 'GradleManagedDeviceTestingNew'
include ':app'
Solution
You should add a resolutionStrategy to settings.gradle as below.
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
resolutionStrategy {
eachPlugin {
if (requested.id.id == 'dagger.hilt.android.plugin') {
useModule("com.google.dagger:hilt-android-gradle-plugin:2.40.5")
}
}
}
}
Then, add the hilt plugin as below to the module level build.gradle file, it was updated correctly.
plugins{
*****
id 'dagger.hilt.android.plugin'
}
Answered By - Mr.Sanchez
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.