har-123 opened a new issue, #1833: URL: https://github.com/apache/cordova-android/issues/1833
# Bug Report After upgrading from: cordova-android 13.0.0 → 14.0.1 Gradle 8.7 → 8.13 (for compatibility) I observed that JUnit test cases in a submodule fail when run via the CLI (./gradlew) or on CI (GitHub Actions), but pass consistently when run directly via Android Studio. ## Information **Observed Behavior** Running the test suite: `./gradlew :EventBus:testReleaseUnitTest` Fails with the following error: ``` Caused by: java.lang.NoClassDefFoundError: com/ukg/common/eventbus/EventBus Caused by: java.lang.ClassNotFoundException: com.ukg.common.eventbus.EventBus ``` But: ✅ These same tests pass when executed directly using Android Studio’s test runner. ✅ Classpaths appear identical between both environments. ✅ Production and test code are compiled correctly. **Steps to Reproduce** 1. Upgrade a multi-module Cordova Android project from 13.0.0 to 14.0.1. 2. Update Gradle version from 8.7 to 8.13. 3. Run unit tests for a submodule (e.g. :EventBus) via: `./gradlew :EventBus:testReleaseUnitTest` **Project Structure** - Cordova Hybrid Project using cordova-android 14.0.1 - Submodules: :app, :EventBus, :mobile-common, etc. - Failing module: :EventBus - Tests written in both Kotlin and Java - Kotlin classes used in main sourceset (e.g., SubscriberExt.kt) ### Environment, Platform, Device **Key Configuration** Gradle (Project EventBus) – Simplified: ``` plugins { id 'com.android.library' id 'org.jetbrains.kotlin.android' } android { compileSdk 35 defaultConfig { minSdkVersion 26 targetSdkVersion 35 } testOptions { unitTests.returnDefaultValues = true } kotlinOptions { jvmTarget = JavaVersion.VERSION_11 freeCompilerArgs = List.of("-Xstring-concat=inline") } } dependencies { testImplementation 'junit:junit:4.12' testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.0' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.0' testImplementation 'org.mockito:mockito-core:4.2.0' testImplementation 'org.mockito.kotlin:mockito-kotlin:4.0.0' } ``` **Suspected Causes** - Gradle (8.13) or AGP (plugin 8.x) may not be compiling Kotlin main sources correctly for unit test classpath when used in a library module. - Cordova's internal hooks or structure may unintentionally interfere with how Gradle test classpaths are assembled for submodules. - Possibly a bug in how testReleaseUnitTest resolves classpaths in projects with Kotlin dependencies and custom hooks. - Kotlin test support might be partially broken due to missing configuration on Cordova side after upgrade. ### Version information - Cordova CLI: 11.0.0 - cordova-android: 14.0.1 - Gradle: 8.13 - Kotlin Gradle Plugin: 1.9.24 - AGP: Tested with 8.3.0+ - JDK: 17 - Node: 20.x - Tests work only in Android Studio, not with ./gradlew or CI. ## Checklist <!-- Please check the boxes by putting an x in the [ ] like so: [x] --> - [ x] I searched for existing GitHub issues - [x ] I updated all Cordova tooling to most recent version - [x ] I included all the necessary information above -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org