Not clear checkModules instruction: Gradle Plugin fails with NPE
See original GitHub issueDescribe the bug I found out very interesting feature — checkModules Gradle plugin from Koin. But unfortunately executing Gradle task “checkModules” leads to NPE. I’m sure the guide is not clear.
That’s the error:
C:\Development\Projects\Pet\Ubily>gradlew checkModules
Configuration on demand is an incubating feature.
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':checkModules'.
> java.lang.NullPointerException (no error message)
* 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.
* Get more help at https://help.gradle.org
BUILD FAILED in 693ms
To Reproduce
- Define multimodule Android project.
- Define Koin modules for each one.
- Make sure it works correctly.
- Apply next build.gradle file:
apply plugin: 'koin'
buildscript {
ext.kotlin_version = '1.3.71'
repositories {
google ()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.koin:koin-gradle-plugin:2.1.5"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
- Write JUnit Test:
@Category(CheckModuleTest::class)
class KoinModulesTest : KoinTest {
@Test
fun checkAllModules() = checkModules {
modules(koinModules) // there are all modules of the project
}
}
- Then run command from Android Studio terminal:
gradlew checkModules
Expected behavior Correct work of the command “checkModules”, without NPE.
Koin project used and used version (please complete the following information):
-
org.koin:koin-gradle-plugin:2.1.5
-
implementation "org.koin:koin-androidx-scope:2.1.5" implementation "org.koin:koin-androidx-viewmodel:2.1.5" testImplementation "org.koin:koin-test:2.1.5"
Issue Analytics
- State:
- Created 3 years ago
- Reactions:8
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Dealing with validation problems - Gradle User Manual
This error occurs whenever a task or artifact transform is cacheable and that a file or file collection input property isn't declaring how...
Read more >java.lang.NullPointerException (no error message)
I've deleted .gradle folder from the project and was able to rebuild it again. N.B: Make a backup, just in case.
Read more >gradle-pitest-plugin: Gradle plugin for PIT Mutation Testing
Otherwise Gradle will resolve pitest to the configuration and not the task. Generic approach. “The plugins way” has some limitations. As the primary...
Read more >The Google Services Gradle Plugin
gradle file matches the package name you entered when creating the google-services.json file. If you are not sure, run through the getting started...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For Android projects to proper check DI graph, you need to run the test using Robolectric or run it on an Android device
I think I found the reason, it may be because I have flavors on my sample module.
Sounds like a candidate for a separate issue, right?