today, i update to bumblebee android version, and i create new project and i import some lib, include dagger-hilt. in build.gradle (module) i insert:
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-android'
id 'kotlin-kapt'
id 'dagger.hilt.android.plugin'
id 'androidx.navigation.safeargs'
}
dependencies {
...
implementation "com.google.dagger:hilt-android:2.38.1"
kapt "com.google.dagger:hilt-compiler:2.38.1"
androidTestImplementation "com.google.dagger:hilt-android-testing:2.38.1"
kaptAndroidTest "com.google.dagger:hilt-compiler:2.38.1"
testImplementation "com.google.dagger:hilt-android-testing:2.38.1"
kaptTest "com.google.dagger:hilt-compiler:2.38.1"
}
and in build.gradle (project) i insert:
plugins {
id 'com.android.application' version '7.1.0' apply false
id 'com.android.library' version '7.1.0' apply false
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
id 'androidx.navigation.safeargs.kotlin' version '2.4.0-beta02' apply false
id 'dagger.hilt.android.plugin' version '2.38.1' apply false
}
but android studio build fail:
Build file 'H:\AndroidProject\WMTWorkmanagerTodolist\build.gradle' line: 7
Plugin [id: 'dagger.hilt.android.plugin', version: '2.38.1', apply: false] was not found in any of the following sources:
Try: Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Exception is: org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'dagger.hilt.android.plugin', version: '2.38.1', apply: false] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'dagger.hilt.android.plugin:dagger.hilt.android.plugin.gradle.plugin:2.38.1') Searched in the following repositories: Gradle Central Plugin Repository Google MavenRepo
why? how do i can fix it. Thank for support.
CodePudding user response:
Add this classpath 'com.google.dagger:hilt-android-gradle-plugin:2.40.5' to your project build.gradle file or read this https://dagger.dev/hilt/gradle-setup.html#hilt-gradle-plugin
CodePudding user response:
I solved it with this answer https://stackoverflow.com/a/70556278/5332110
Also make sure you're using this version of Kotlin:
id 'org.jetbrains.kotlin.android' version '1.5.31' apply false
Additional information: https://developer.android.com/studio/releases/gradle-plugin?buildsystem=ndk-build#settings-gradle
