-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error: Parceler: Code generation did not complete successfully. #394
Comments
Yikes! What are you trying to annotate? |
RealmObject's. They were working fine, but I updated to the the latest version of IntelliJ (2020.3) and this error started to occur. No code changes on my end. I am guessing some library updated that Parceler doesn't like, but the error message "error: Parceler: Code generation did not complete successfully" and this stack trace does not help me in locating the issue. |
Can you run the build on the command line? |
I encounter the same problem, and I cannot build it from command line: |
You can try it with:
When I open it up in AndroidStudio, let gradle build it and just click "run app" it works. |
@tobiasKaminsky - I believe your case is caused by the incompatibility between lombok and other annotation processors like Parceler. See https://stackoverflow.com/questions/37543057/parceler-and-lombok-not-working-together I am open to a PR to address this problem, if it can be addressed. |
so this is really strange. Our case is somehow solved, as we use only Android Studio or CI (and therefore always start with a clean docker container). |
I have the same issue when I updated to latest version of Android Studio. I don't have lombok. The only other annotation processor I have is org.permissionsdispatcher:permissionsdispatcher-processor, but the only thing you annotate there is some functions in activities, so not the same object as parceler. It has been working fine for years, but did break with latest version of Android Studio. I also use Realm. I've spent hours try to find the solution, but I don't know what the problem is. The stacktrace is similar to the first one. Here is a part of it:
|
@johncarl81 same for me, updated to a new version of android studio and got the same issue |
Also use Realm |
@bitsydarel I have the very same issues. |
@hdralexandru Did you found from the release notes of the android gradle plugin what’s causing this ? |
No. |
confirm AS 4.2 not working. downgrade to 4.1.3 work fine! |
Strange, and I assume running it through Gradle directly still works. Any more clues why it's failing? |
Have some issue. Have any ideas, how to fix it without downgrade? |
It's something to do with some type Parceler is analyzing coming up as the type. I'll investigate further later this weekend. If anyone is interested, this is an open-source project and the annotation processor is (should be) easy to debug. |
On AS 4.1.3 I would get this warning, but the build would still finish:
Maybe AS 4.2 crashes the build directly? I've tried to add
But I've been given the warning that the argument has not been used. |
Strange thing is that AS 4.2 with the android gradle plugin 4.1.3 still make the build fail. but downgrade to AS 4.1.3 does not make the build fail. the processor does not give insightful error for this issue and the lib provide many functionality so debugging the processor would be difficult. would be great if the processor would at least point the object creating this issue. |
AS 4.2 now uses Java 11 as default. We have a project (https://github.com/nextcloud/talk-android) which fails with JDK 11, but not with 8. Java 11:
Java 8:
|
@johncarl81 Did you find anything during the investigation of the problem? |
Has anyone found a fix or workaround for this yet? It's a bit frustrating to need to stay on an old version of Android Studio to be able to build your projects, and it will not be a sustainable solution. :/ |
You can use new Android Studio, but have to manually configure old Java 8. |
This is what I'm using but still manage to fail.
|
Let's hope @johncarl81 who know how it should work, can find a solution soon! |
@tobiasKaminsky how to manually configure old Java 8 please? |
On Arch there is a script to change it system wide. |
Just want to confirm that Tobias is correct, setting the compiler for gradle to Java 8 in Android Studio 4.2.x fixes the issue. It looks like it's from making the jump from 8 -> 11, maybe to do with access to private members via reflection going away in Java 9? (just a random guess). You can make the change in file/ project structure/sdk location/jdk location. |
Ok, it seems the problem is referencing classes that have yet to be generated, like the Realm proxy classes. So situations like the following: @Parcel(implementations = {com_example_parcelertest_VisitRealmProxy.class},
value = BEAN,
analyze = Visit.class)
public class Visit extends RealmObject {
...
} causes an |
I'm not sure if the execution order realm plugin is to blame, as it's really depending on the JDK used for compiling. Having said that i've been unable to reproduce the issue without the realm plugin activated. So different JDK could change the order of plugin execution? I'm not that familiar with plugins, so really don't know:( But interestingly when running the project tests, and switching the project SDK to 11 the |
Yeah, that's likely unrelated - It's failing due to robolectric which apparently needs some attention with the JDK 11 upgrade. |
I've been digging around a bit more, and some thing i've noticed, by using the "old" annotationProcessor, instead of kapt I can get the plugin to work using JDK11. But unfortunately this does generate a whole lot of different problems using modern Android jetpack libraries. (i've used the kapt |
@tgobbens where did you add this? In project or app build.gradle? And in which part of the build.gradle? |
I've added this in the app build.gradle, you will need one of the latest kotlin releases for this option.
But be aware this does break al lot of different libraries (e.g. databinding) so I wouldn't recommend this. |
It fails if the java version is 11. So instead of building with AS, i'm using Example on MacOS : $ export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home
$ ./gradlew blablabla |
Is there any information on how to build / debug the plugin so I could try to debug? Currently this issue is preventing us from upgrading to Gradle 7.0 making it impossible to use Android Compose. |
It's pretty straightforward. First, you clone and build the parceler project:
Then open up the project in your favorite IDE to prepare to debug. Next, build your project with debugging on (I'm assuming you're using gradle here): Add the following to your gradle.properties file:
Run the build:
This should pause and wait for you to attach the debugger. Next attach the debugger from your IDE with the parceler project. The Intellij configuration for me looks like the following: Hope this works for you @tgobbens |
Any updates on this problem? |
Still no update on this one? It would be nice to be able to update Java version beyond v1.8! |
@tgobbens Did you have more time to look into this to see if you could find a solution? Or if @johncarl81 have more time now to help fixing the bug? It would be extremely appreciated! |
I didn't put any more effort into this issue. instead decided to migrate away from this library. |
You're using Realm database, right? |
Yes, the problem for me was indeed the combination with Realm. Migrating away from this library was tricky as a lot of our legacy code was relying on the functionality. Eventually we took the generated |
Thanks for the information, I'll give it a try! |
@bisydarel @hdralexandru @toadz @johncarl81 @dimzhurwork @AndyScherziner @Maxxan @tobiasKaminsky @Draketheb4dass @kingd-richer @tgobbens @kwiky Hi folks, I am running into exact same problem. Has anyone finally figured out how to get Parceler and Realm to work with latest released Android Studio? |
Having same issue on AS 2023.1.1, @sergiva-mp manage to get it work on your side ? |
Compiling to an Android Device (Real or Virtual) just started failing. Any clue as to why in this stacktrace?
The text was updated successfully, but these errors were encountered: