'Could not Resolve koin while transfering from jcenter to maven
I am working on a project which I used koin but I had the dependencies added from jcenter and not maven. Since jcenter is going to get deprecated I want to transfer to maven. So i removed Jcenter and I added mavenCentral(). The thing is that when i try to sync my project this error occures :
Could not resolve io.insert-koin:koin-androidx-scope:2.2.3.
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
Firstly, I followed the tutorial of insert-koin.io but nothing helped. When I try to press Run then the error of course still occurs.
Execution failed for task ':domain:compileKotlin'.
Could not resolve all files for configuration ':domain:compileClasspath'. Could not resolve io.insert-koin:koin-androidx-scope:2.2.3. Required by: project :domain > No matching variant of io.insert-koin:koin-androidx-scope:2.2.3 was found. The consumer was configured to find an API of a library compatible with Java 11, preferably in the form of class files, preferably optimized for standard JVMs, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' but: - Variant 'releaseApiPublication' capability io.insert-koin:koin-androidx-scope:2.2.3 declares an API of a library, and its dependencies declared externally: - Incompatible because this component declares a component, with the library elements 'aar' and the consumer needed a component, preferably in the form of class files - Other compatible attributes: - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs) - Doesn't say anything about its target Java version (required compatibility with Java 11) - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'jvm') - Variant 'releaseRuntimePublication' capability io.insert-koin:koin-androidx-scope:2.2.3 declares a runtime of a library, and its dependencies declared externally: - Incompatible because this component declares a component, with the library elements 'aar' and the consumer needed a component, preferably in the form of class files - Other compatible attributes: - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs) - Doesn't say anything about its target Java version (required compatibility with Java 11) - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'jvm')
- Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Does anybody have any idea what i should do ?
Solution 1:[1]
Still you should be able to use jcenter (read only) in gradle file if your artifacts not present in other repositories.
Solution 2:[2]
You should check the section in your build.gradle. You need mavenCentral()
// Add Maven Central to your repositories if needed
repositories {
mavenCentral()
}
Solution 3:[3]
Add mavenCentral() if it is not in settings.gradle as below.
pluginManagement {
repositories {
...
mavenCentral()
}
If your impl is like implementation "org.koin:koin-android:$XX", replace it with implementation "io.insert-koin:koin-android:$koin_version" in app build.gradle.
Solution 4:[4]
Koin packages are now on maven central. please refer to the new setup instructions for it https://insert-koin.io/docs/setup/v3.2
So the gradle group name changed from org.koin to io.insert-koin
And here is an example :
implementation "io.insert-koin:koin-core:$koin_version"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | sankar dunga |
| Solution 2 | Alexander |
| Solution 3 | burak isik |
| Solution 4 | Melad |
