-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Intellij IDEA 12: Duplicate class error for generated classes #423
Comments
Do you use Maven ? |
Nope. Not at the moment. |
Btw. I haven't switched to 2.7 yet. Still on 2.6. |
This issue may be resolved by 2.7, it would be nice if you could try to use it :) . At least as a test. |
Sure. Back on Idea 11 to get a minor release out. Will give IDEA 12 a shot On Thu, Dec 6, 2012 at 6:10 PM, Pierre-Yves Ricau
|
Hate to say: But I have the same problem with IDEA 11 as well. With «mvn clean» as a good workaround. Strange thing: I never actually found the 2nd class file. |
Ok. Tried with Idea 12 again and AA 2.7. These are my steps:
I get a "cannot find symbol" error for all AA classes. The aa-gen folder is empty. Problem is that I don't have maven set up with this project due to issues with library projects with NDK dependencies earlier. I can't use something like mvn clean. Let me know if I am going wrong somewhere. This setup works with Idea 11 so am guessing something changed with Idea itself. |
I can confirm this bug with AA 2.7, Idea 12 and Maven. mvn clean didn't help. This might sound silly but I got it working by removing the @EActivity annotation from the main (and removing _ from the activity name in AndroidManifest file). Ran it once, changed back to AA again. But then, if you rebuild, it breaks again. Weird. |
Finally got it working! The problem is not with AA but with how you setup your sources directory. I spent a lot of hours setting up Android with Maven + ActionBarSherlock + Roboelectric + AndroidAnnotations with IntelliJ IDEA 12. I've written a long blog post (with code snippets and screenshots) on how to setup everything from scratch here - http://www.ashokgelal.com/2012/12/setting-up-intellij-idea-12-with-maven-actionbarsherlock-roboelectric-androidannotations/. Hopefully, it will be useful for others. |
@ashokgelal Thanks! Looks great. I'll try setting up Maven here again. If anyone has had success without using Maven, please let me know! |
i've also written up a small stackoverflow answer on this issue and my experiences (i'm not using maven, just AA and ActionBarSherlock + EventBus). The only problem I have is that everytime i change a source which uses AA, and just "run" my project (or first make my main module), is that it will crash because of an NPE (of an added @bean) in a superclass of that edited source (which also uses AA). So i have to rebuild my entire project every time i want to test something. My main guess is that I don't see any AA output when I make my main module, so i guess AA is only run on a rebuild. |
See: http://youtrack.jetbrains.com/issue/IDEA-96797 & http://youtrack.jetbrains.com/issue/IDEA-96342 However I don't have success with either solution. Apparently the build system was replaced in v12. |
So, just to be clear : is the problem solved for everybody with this article : http://www.ashokgelal.com/2012/12/setting-up-intellij-idea-12-with-maven-actionbarsherlock-roboelectric-androidannotations/ ? |
Actually I just updated to IntelliJ 12.0.1 and that particular problem is gone. I'm able to compile now. @Trikke maybe you try to upgrade as well and let us know. |
@ened Great. I shall upgrade and give it a shot. Nothing else worked for me without Maven though. |
Hey guys, feel free to suggest any change to the Maven-IntellijIdea and IntelliJIDEA wiki pages. I don't use IntelliJIDEA yet so I can't help much there for now. It's on my TODO list for next year though. I'm gonna work in an Android team that uses IDEA a lot so it's a good time to switch. |
I'd be nice (and helpful for others) if you can add the link http://www.ashokgelal.com/2012/12/setting-up-intellij-idea-12-with-maven-actionbarsherlock-roboelectric-androidannotations/ to the IntelliJ + Maven wiki. |
@pyricau Upgrading to 12.0.1 works for me too. I believe this was the bug which has been fixed in IDEA: http://youtrack.jetbrains.com/issue/IDEA-96230#. No changes were required in the steps but I think it would be nice to mention that AA works with 12.0.1 in the wiki. |
Thanks guys! |
I don't know if it's only me but I'm facing the same issue using IntelliJ 12.1.1. Downgrading to 12.0.4 fixes the issue. Any idea? |
@romainpiel I've seen this too. If you have followed my tutorial on http://www.ashokgelal.com/2012/12/setting-up-intellij-idea-12-with-maven-actionbarsherlock-roboelectric-androidannotations/, use aa for Production sources directory, and aa-test for Test sources directory. You probably want to delete the gen folder first as well as do a |
oh I missed that step, thanks man! |
Im using regular 2.7.1 jars, and appear work fine now. describe here my instructions: 1.- Add androidannotations to /lib These steps works for me, before i was using gen/aa as folder, but fails sometimes with duplicate class, now with "gen" work fine, and i think that is not bad mix it with R and others. Thanks alls for the tips! |
I just upgraded to Intellij IDEA 12 Community Edition. On compiling my project I have started getting a duplicate class error on all annotated classes. For ex:
java: activities/BaseMapActivity_.java:16: duplicate class: activities.BaseMapActivity_
I do not get the warning as mentioned in this report on the JetBrains bug tracker: http://youtrack.jetbrains.com/issue/IDEA-94150. I removed the generated source folder from the source path but no luck. I get a no symbol found error then.
The text was updated successfully, but these errors were encountered: