Closed jd565 closed 1 year ago
We have created an umbrella ticket for all things related to Gradle 8.0. Please track progress here https://github.com/realm/realm-java/issues/7773
@jd565 Could you confirm that this issue exists in the following scenario: 10.13.2-transformer-api AGP 7.4.1 Gradle 7.5
I wasn't able to run unit tests on that scenario, it will rule out that is related to Gradle 8.
The issue is not related to Gradle v8 but to the new transformer implementation. No tests (unit/instrumented) can be executed if any version of Realm with the new transformer API is selected.
Instrumented tests case execution fail with:
Execution failed for task ':app:debugAndroidTestRealmAccessorsTransformer'.
(...)
Caused by: javassist.NotFoundException: io.realm.internal.RealmObjectProxy
at javassist.ClassPool.get(ClassPool.java:422)
at io.realm.transformer.build.FullBuild.findModelClasses(FullBuild.kt:87)
at io.realm.transformer.build.FullBuild.filterForModelClasses(FullBuild.kt:115)
at io.realm.transformer.build.BuildTemplate.prepareReferencedClasses(BuildTemplate.kt:86)
at io.realm.transformer.RealmTransformer.transform$realm_transformer(RealmTransformer.kt:184)
at io.realm.transformer.ModifyClassesTask.taskAction(RealmTransformer.kt:270)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:125)
... 112 more
While the unit tests does not throw any error or execute any tests.
The issue about not resolving RealmObjectProxy
on instrumented tests is because of how we handle dependencies in our gradle plugin. While we work out a solution, a workaround for running Instrumented tests is adding the realm-android-library
dependency to androidTestImplementation
.
We are still investigating why unit tests are not run with the transformer-api release.
Actually, there is an issue with this workaround for it:
This has been fixed in 10.13.3-transformer-api
How frequently does the bug occur?
Always
Description
Just upgraded dependencies on the project. Updated to Gradle 8 and realm 10.13.2-transformer-api, AGP 7.4.1. Everything seemed to compile ok but many unit tests are not run.
Looking over the modules, if a module applied the realm plugin, it was now reporting 0 tests where it definitely had tests before. If I remove the realm plugin from being applied the tests started running again.
These tests are not using realm or mocking realm in any way but are still removed. To be clear these are unit tests (under the test folder) as opposed to instrumentation/android tests (under the androidTest folder). I tried adding
testImplementation "io.realm:realm-android-library:10.13.2-transformer-api"
but this made no difference.Stacktrace & log output
No response
Can you reproduce the bug?
Always
Reproduction Steps
Project with gradle 8, realm 10.13.2-transformer-api and add some unit tests
Version
10.13.2-transformer-api, 10.12.0-transformer-api
What Atlas App Services are you using?
Local Database only
Are you using encryption?
No
Platform OS and version(s)
Mac
Build environment
No response