Using last android plugin (3.0.0-alpha1) running the connectedAndroidTest task makes it crash on compile with a Error:Execution failed for task ':app:transformClassesWithRealmTransformerForDebugAndroidTest'.
javassist.NotFoundException: com.package.myapp.model.MyModel
the app compilation itself works, but the androidTest can't find the classes.
It's a 100% Kotlin project.
If you need a sample project I can give one for you I think (it is reproductible on the projects I work on)
Realm version(s): 3.2.0
Realm sync feature enabled: no
Android Studio version: 3.0.0
Using Kotlin and gradle 4.0.0-m2
We'll definitely have a look at this. We don't support the alpha1 plugin, at this point.
Hi,
I get the same thing
100% Kotlin project
Realm version(s): 3.2.1
Realm sync feature enabled: no
Android Studio version: 3.0.0 canary 2
Gradle wrapper 4.0.0-m2
Kotlin-Gradle 1.1.2-4
./gradlew clean test check assemble passes.
./gradlew clean test check connectedAndroidTest assemble fails with
javassist.NotFoundException: com.package.myapp.model.MyModel
I'm also having the same problem.
Is there any sense of when we might see a fix for this? I'd rather not re-write our model classes in Java if this is going to be fixed in the short term, but I might have to if this issue is going to take a long time to solve.
Have you tried using the latest stable version 2.3.2 instead? The 3.0.0-alpha has quite a number of bugs, so ruling that out first would be good.
It works on stable (2.3.2) and latest 2.4.0-alpha7. I made an issue here because I'm not sure if it's a bug or a need to implement some new features (like the fact they changed how flavors and dimensions works for example)
Most likely it is a bug in the 3.0.0 plugin. We have not heard of any changes required by our end yet. I would recommend that you create an issue in the google bugtracker instead: https://issuetracker.google.com/issues?q=componentid:192709%2B
We will keep this issue open just to keep track of it on our end as well.
Some more infos, when it works (using a realm model written in java) :
09:59:55.335 [DEBUG] [org.gradle.internal.progress.DefaultBuildOperationExecutor] Build operation 'Resolve files of :app:debugRuntimeClasspath' completed
09:59:55.355 [DEBUG] [realm-logger] Add boot class /Users/nitrog42/Dev/android-sdk-macosx/platforms/android-25/android.jar to class pool.
09:59:55.357 [DEBUG] [realm-logger] ClassPool contains Realm classes: true
09:59:55.357 [DEBUG] [realm-logger] Proxy Mediator Classes: []
09:59:55.359 [DEBUG] [realm-logger] Model Classes: [com.nitrog42.realm3sample.TestModelJava]
09:59:55.359 [DEBUG] [realm-logger] Managed Fields: [id]
09:59:55.359 [DEBUG] [realm-logger] Modifying class android.support.test.rule.R$string
09:59:55.359 [DEBUG] [realm-logger] Behavior: R$string
09:59:55.359 [DEBUG] [realm-logger] Modifying class com.nitrog42.realm3sample.test.R$string
09:59:55.360 [DEBUG] [realm-logger] Behavior: R$string
09:59:55.360 [DEBUG] [realm-logger] Modifying class android.app.R
09:59:55.360 [DEBUG] [realm-logger] Behavior: R
09:59:55.361 [DEBUG] [realm-logger] Modifying class android.support.test.espresso.idling.R
09:59:55.361 [DEBUG] [realm-logger] Behavior: R
09:59:55.361 [DEBUG] [realm-logger] Modifying class android.support.test.rule.R
09:59:55.361 [DEBUG] [realm-logger] Behavior: R
09:59:55.361 [DEBUG] [realm-logger] Modifying class com.nitrog42.realm3sample.ExampleInstrumentedTest
09:59:55.362 [DEBUG] [realm-logger] Behavior: ExampleInstrumentedTest
09:59:55.362 [DEBUG] [realm-logger] Behavior: useAppContext
09:59:55.362 [DEBUG] [realm-logger] Modifying class android.support.test.espresso.R$string
09:59:55.362 [DEBUG] [realm-logger] Behavior: R$string
09:59:55.362 [DEBUG] [realm-logger] Modifying class android.support.test.espresso.R
09:59:55.362 [DEBUG] [realm-logger] Behavior: R
09:59:55.363 [DEBUG] [realm-logger] Modifying class com.nitrog42.realm3sample.test.R
09:59:55.363 [DEBUG] [realm-logger] Behavior: R
09:59:55.363 [DEBUG] [realm-logger] Modifying class com.nitrog42.realm3sample.test.BuildConfig
09:59:55.364 [DEBUG] [realm-logger] Behavior: BuildConfig
09:59:55.364 [DEBUG] [realm-logger] Behavior: <clinit>
09:59:55.364 [DEBUG] [realm-logger] Field being accessed: com.nitrog42.realm3sample.test.BuildConfig.DEBUG
09:59:55.364 [DEBUG] [realm-logger] Modifying class android.support.test.R
09:59:55.364 [DEBUG] [realm-logger] Behavior: R
09:59:55.366 [DEBUG] [realm-logger] Realm Transform time: 30 milliseconds
09:59:55.699 [DEBUG] [sun.net.www.protocol.http.HttpURLConnection] sun.net.www.MessageHeader@6c1e4ada5 pairs: {GET /track/?data=ewogICAiZXZlbnQiOiAiUnVuIiwKICAgInByb3BlcnRpZXMiOiB7CiAgICAgICJ0b2tlbiI6ICJjZTBmYWMxOTUwOGY2YzhmMjAwNjZkMzQ1ZDM2MGZkMCIsCiAgICAgICJkaXN0aW5jdF9pZCI6ICIyNzlmMmYxMDJjNDFkYjkxMDk4ZGQzY2EzZjkxYTczM2QxYThjZmQ3ZjJkYTE1YWM3MTA1YzY5MmJiZjY2OTMwIiwKICAgICAgIkFub255bWl6ZWQgTUFDIEFkZHJlc3MiOiAiMjc5ZjJmMTAyYzQxZGI5MTA5OGRkM2NhM2Y5MWE3MzNkMWE4Y2ZkN2YyZGExNWFjNzEwNWM2OTJiYmY2NjkzMCIsCiAgICAgICJBbm9ueW1pemVkIEJ1bmRsZSBJRCI6ICJlM2IwYzQ0Mjk4ZmMxYzE0OWFmYmY0Yzg5OTZmYjkyNDI3YWU0MWU0NjQ5YjkzNGNhNDk1OTkxYjc4NTJiODU1IiwKICAgICAgIkJpbmRpbmciOiAiamF2YSIsCiAgICAgICJMYW5ndWFnZSI6ICJrb3RsaW4iLAogICAgICAiU3luYyBWZXJzaW9uIjogbnVsbCwKICAgICAgIlJlYWxtIFZlcnNpb24iOiAiMy4zLjIiLAogICAgICAiSG9zdCBPUyBUeXBlIjogIk1hYyBPUyBYIiwKICAgICAgIkhvc3QgT1MgVmVyc2lvbiI6ICIxMC4xMi41IiwKICAgICAgIlRhcmdldCBPUyBUeXBlIjogImFuZHJvaWQiLAogICAgICAiVGFyZ2V0IE9TIFZlcnNpb24iOiAiMjUiLAogICAgICAiVGFyZ2V0IE9TIE1pbmltdW0gVmVyc2lvbiI6ICIxOSIKICAgfQp9&ip=1 HTTP/1.1: null}{User-Agent: Java/1.8.0_112}{Host: api.mixpanel.com}{Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2}{Connection: keep-alive}
09:59:55.827 [DEBUG] [sun.net.www.protocol.http.HttpURLConnection] sun.net.www.MessageHeader@6821c38113 pairs: {null: HTTP/1.1 200 OK}{Server: nginx/1.11.1}{Date: Tue, 20 Jun 2017 07:59:58 GMT}{Content-Type: application/json}{Content-Length: 1}{Connection: keep-alive}{Cache-Control: no-cache, no-store}{Access-Control-Allow-Origin: *}{Access-Control-Allow-Headers: X-Requested-With}{Access-Control-Allow-Methods: GET, POST, OPTIONS}{Access-Control-Allow-Credentials: true}{Access-Control-Max-Age: 1728000}{Access-Control-Expose-Headers: X-MP-CE-Backoff}
09:59:55.827 [DEBUG] [org.gradle.internal.progress.DefaultBuildOperationExecutor] Completing Build operation 'Execute task action 5/5 for :app:transformClassesWithRealmTransformerForDebugAndroidTest'
09:59:55.827 [DEBUG] [org.gradle.internal.progress.DefaultBuildOperationExecutor] Build operation 'Execute task action 5/5 for :app:transformClassesWithRealmTransformerForDebugAndroidTest' completed
09:59:55.828 [DEBUG] [org.gradle.api.internal.changedetection.rules.TaskTypeTaskStateChanges] Task :app:transformClassesWithRealmTransformerForDebugAndroidTest implementation: com.android.build.gradle.internal.pipeline.TransformTask_Decorated@e4fab6476e5c78d70e7f8526d2c3d958
09:59:55.828 [DEBUG] [org.gradle.api.internal.changedetection.rules.TaskTypeTaskStateChanges] Task :app:transformClassesWithRealmTransformerForDebugAndroidTest action implementations: [org.gradle.api.internal.project.taskfactory.AbstractOutputPropertyAnnotationHandler$2$1@babd94bf44c263eced41758eeeb9b0ff, org.gradle.api.internal.project.taskfactory.AbstractOutputPropertyAnnotationHandler$2$1@babd94bf44c263eced41758eeeb9b0ff, org.gradle.api.internal.project.taskfactory.AbstractOutputPropertyAnnotationHandler$2$1@babd94bf44c263eced41758eeeb9b0ff, org.gradle.api.internal.project.taskfactory.TaskClassValidator@babd94bf44c263eced41758eeeb9b0ff, com.android.build.gradle.internal.pipeline.TransformTask_Decorated@e4fab6476e5c78d70e7f8526d2c3d958]
And when it doesn't (using a realm model written in kotlin) :
09:55:37.712 [DEBUG] [org.gradle.internal.progress.DefaultBuildOperationExecutor] Build operation 'Resolve files of :app:debugRuntimeClasspath' completed
09:55:37.732 [DEBUG] [realm-logger] Add boot class /Users/nitrog42/Dev/android-sdk-macosx/platforms/android-25/android.jar to class pool.
09:55:37.734 [DEBUG] [realm-logger] ClassPool contains Realm classes: true
09:55:37.734 [DEBUG] [realm-logger] Proxy Mediator Classes: []
09:55:37.736 [DEBUG] [org.gradle.internal.progress.DefaultBuildOperationExecutor] Completing Build operation 'Execute task action 5/5 for :app:transformClassesWithRealmTransformerForDebugAndroidTest'
09:55:37.736 [DEBUG] [org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter] Removed task artifact state for {} from context.
09:55:37.736 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':app:transformClassesWithRealmTransformerForDebugAndroidTest'
09:55:37.736 [LIFECYCLE] [class org.gradle.internal.buildevents.TaskExecutionLogger] :app:transformClassesWithRealmTransformerForDebugAndroidTest FAILED
09:55:37.737 [DEBUG] [org.gradle.internal.progress.DefaultBuildOperationExecutor] Completing Build operation 'Task :app:transformClassesWithRealmTransformerForDebugAndroidTest'
09:55:37.737 [DEBUG] [org.gradle.internal.progress.DefaultBuildOperationExecutor] Build operation 'Task :app:transformClassesWithRealmTransformerForDebugAndroidTest' completed
09:55:37.737 [INFO] [org.gradle.execution.taskgraph.DefaultTaskPlanExecutor] :app:transformClassesWithRealmTransformerForDebugAndroidTest (Thread[Daemon worker Thread 4,5,main]) completed. Took 0.064 secs.
Could this be coming from Kotlin ? Should I file an issue on there bug tracker too ?
Here's the last line of the error log btw :
./gradlew -debug transformClassesWithRealmTransformerForDebugAndroidTest > kotlin.txt
09:55:36.583 [ERROR] [system.err] Note: Processing class TestModelJava
09:55:36.583 [ERROR] [system.err] Note: Processing class TestModel
09:55:36.584 [ERROR] [system.err] Note: Creating DefaultRealmModule
09:55:37.738 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
09:55:37.738 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
09:55:37.738 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
09:55:37.738 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
09:55:37.738 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Execution failed for task ':app:transformClassesWithRealmTransformerForDebugAndroidTest'.
09:55:37.738 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > javassist.NotFoundException: com.nitrog42.realm3sample.TestModel
09:55:37.738 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
09:55:37.738 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try:
09:55:37.738 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Run with --stacktrace option to get the stack trace.
09:55:37.738 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger]
09:55:37.738 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] BUILD FAILED in 2s
@NitroG42 I may run into the same issue. But interesting thing is it works fine with command line gradle, but fails with Android Studio (2.3.3). After building with command line once, it will work in the AS as well ... Looks like something wrong with the Android Studio?
Well it doesn't run with command line on my side (gradle 4.0). Did you try my sample project ? (you can update it to 3.0.0-alpha4 and gradle 4.0)
I didn't try Android Studio 2.3.3 though.
Sorry I forgot the sample in the google issue, here it is (and updated) :
Realm3Sample.zip
Just unzip and run ./gradlew connectedAndroidTest
I would be grateful if you could take a look, at least just to see from which side the issue might come (need an update on the Realm side, Kotlin side, or Google side).
Thank you !
@NitroG42 Thank you for providing the project.
I've reproduced the issue and confirmed that android grade plugin 2.3.3 worked well.
And I also tried my/agp_3.0.0 branch in our repository that contains android grade plugin 3.0.0 support, but still got the same error.
I'll take a look more deeply.
I investigated a bit deeper.
New android grade plugin does not seem to pass main classes written in Kotlin to our transformer as input nor referencedInput. Only classes written in Java are passed as referencedInput.
For now, I could't find a way to work around this.
I was going to ask you for some news but then I saw you were working on it :)
Thank you for the investigation, do you want me to make a bug report kotlin and android side ? I'm going to update the issue I made on the google tracker anyway.
I don't think it as a Kotlin bug since the project works with android grade plugin 2.3.3.
I added a PR #4883 to expose this issue on our example project.
I made another issue on the gradle tracker (probably better for this issue), with the more specific info you gave : https://issuetracker.google.com/issues/63153952
Thank you very much.
A bit of progress on this one - it is marked as fixed:
This is fixed. The fix will show up in the 2nd version after alpha9.
Still doesn't work with Beta 1, at least for me.
still not working for me too...
in the 2nd version after alpha9 =>
As it went from alpha9 to beta1, we could expect the fix in Beta 2 and not Beta 1, that's why it still doesn't work.
As you can see in the issue, the fix won't be out in Beta 2 but in Beta 3.
I can run (and pass) an Espresso Test in AS Beta 3 馃槂
I've confirmed that this issue was solved in Android gradle plugin 3.0.0-beta3.
I'm closing this.
I am getting transformClassesWithRealmTransformerForDevelopmentDebug on gradle 3.1.3. Is it related to this issue?
Realm : 5.3.1
AS : 3.1.2
Gradle : 3.1.3
Java Project
Realm Sync Enabled : no
Hi @sutharsha please open a new issue with a reproducible sample if possible. Does it happen on a fresh build or incremental one?
@nhachicha Happens only in incremental builds. But having to do fresh builds repeatedly is :(
Would not be able to provide sample. Should i still create a new issue?
Most helpful comment
Done: https://issuetracker.google.com/issues/62152896